Operation triggering method and apparatus for machine-to-machine communications

ABSTRACT

Embodiments include a method for triggering an operation in an Internet of Things (IoT) system, wherein the IoT system comprises multiple IoT terminals. The method is implemented in a service capability middleware. The method includes obtaining subject resource information of a subject resource, the subject resource information comprising detected data information of detected data of the subject resource and operation resource information about an operation resource associated with the subject resource, the service capability middleware being integrated in a gateway or a service platform, receiving the detected data of the subject resource from the multiple IoT terminals, determining that the detected data meets a condition for sending an operation request to an object resource, and sending the operation request to the object resource, the condition and the object resource being determined according to the operation resource information.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.16/876,833, filed on May 18, 2020, which is a continuation of U.S.patent application Ser. No. 15/910,592, filed on Mar. 2, 2018, now U.S.Pat. No. 10,681,153. The U.S. patent application Ser. No. 15/910,592 isa continuation of U.S. patent application Ser. No. 14/825,972, filed onAug. 13, 2015, now U.S. Pat. No. 9,936,029. The U.S. patent applicationSer. No. 14/825,972 is a continuation of International Application No.PCT/CN2013/071704, filed on Feb. 20, 2013. All of the aforementionedpatent applications are hereby incorporated by reference in theirentireties.

TECHNICAL FIELD

The present invention relates to the computer field, and in particular,to an operation triggering method and apparatus for machine-to-machinecommunications.

BACKGROUND

Machine-to-machine communications (M2M for short hereinafter) is anetworked application and service centering on intelligentmachine-to-machine interaction. By embedding a wireless or wiredcommunications module and application processing logic in a machine, theM2M implements data communication without manual intervention. In thismanner, information requirements of users in aspects of monitoring,commanding and scheduling, data collection and measurement, and the likeare met. In a conventional typical M2M application network architecture,various M2M terminals (such as a sensor and a microcontroller) access anM2M service platform directly or remotely by using an M2M gateway, whilevarious M2M applications (such as electricity meter reading andintelligent traffic) retrieve, with a service capability provided by theM2M service platform, data collected by the M2M terminals, or performremote control and management on the M2M terminals.

The European Telecommunications Standards Institute (ETSI) M2M uses aRESTful architecture. REST, an acronym for Representational StateTransfer, means “representational state transfer”. If an architecture isbased on REST, the architecture is referred to as a RESTfularchitecture. Its characteristic is that everything is made up ofresources, where a resource is a text segment existing in a network oris in multiple other media forms. Each resource has a unique uniformresource identifier (URI). An application program or service capabilitymiddleware may access the resource using the URI. Each resource isaccessed in fixed manners, including manners such as create, update,delete, and retrieve. In addition, in the RESTful architecture, a clientand a server are both stateless.

In an M2M system, the following scenario exists extensively. When astatus of a device changes, another device or multiple devices mayperform a single operation or a series of operations according towhether the change meets a condition. The action of foregoing operationtriggering is implemented by an application program installed on aspecific device (such as a device that directly performs theoperations). However, in some restricted environments, the device needsto go to sleep periodically, and the application program is interruptedas the device goes to sleep. Consequently, operations between resourcescannot be triggered. In some scenarios in which the device needs to beoffline and used outdoors, a service of the application program isinterrupted as the device is offline. Therefore, in the M2M system,operation triggering using the application program suffers from adisadvantage of poor stability.

SUMMARY

Embodiments of the present invention provide an operation triggeringmethod and apparatus for machine-to-machine communications to improvestability of operation triggering in an M2M system.

A first aspect of embodiments of the present invention provides anoperation triggering method for machine-to-machine communications.Service capability middleware stores a representation of a subjectresource, where the representation of the subject resource includescontent of the subject resource and information about an operationresource associated with the subject resource. The method includes, whenthe content of the subject resource is changed, retrieving, by theservice capability middleware, a change result of the content of thesubject resource stored in the service capability middleware. The methodalso includes retrieving, by the service capability middleware accordingto the information about the operation resource associated with thesubject resource, a representation of the operation resource associatedwith the subject resource. The representation of the operation resourceincludes a condition for sending an operation request to an objectresource and a uniform resource identifier of the object resource. Themethod also includes constructing the operation request for the objectresource when the service capability middleware determines that thechange result meets the condition for sending the operation request tothe object resource in the representation of the operation resource. Themethod also includes sending, by the service capability middleware, theoperation request to the object resource according to the uniformresource identifier of the object resource.

With reference to the first aspect of embodiments of the presentinvention, in a first possible implementation manner, the informationabout the operation resource associated with the subject resource is therepresentation of the operation resource associated with the subjectresource, and the retrieving, by the service capability middlewareaccording to the information about the operation resource associatedwith the subject resource, a representation of the operation resourceassociated with the subject resource, includes retrieving, by theservice capability middleware according to the representation, includedin the representation of the subject resource, of the operation resourceassociated with the subject resource, the representation of theoperation resource associated with the subject resource. In anembodiment, the information about the operation resource associated withthe subject resource is a uniform resource identifier of the operationresource associated with the subject resource, and the retrieving, bythe service capability middleware according to the information about theoperation resource associated with the subject resource, arepresentation of the operation resource associated with the subjectresource, includes: retrieving, by the service capability middlewareaccording to the uniform resource identifier of the operation resourceincluded in the representation of the subject resource, therepresentation of the operation resource associated with the subjectresource. In an embodiment, the information about the operation resourceassociated with the subject resource is a uniform resource identifier ofan operation resource set to which the operation resource associatedwith the subject resource belongs, and the retrieving, by the servicecapability middleware according to the information about the operationresource associated with the subject resource, a representation of theoperation resource associated with the subject resource, includes:retrieving, by the service capability middleware according to theuniform resource identifier, included in the representation of thesubject resource, of the operation resource set to which the operationresource belongs, the representation of the operation resourceassociated with the subject resource, where the representation of theoperation resource associated with the subject resource is arepresentation of an operation resource included in the operationresource set.

With reference to the first aspect of embodiments of the presentinvention or the first possible implementation manner, in a secondpossible implementation manner, before the retrieving, by the servicecapability middleware, a change result of the content of the subjectresource stored in the service capability middleware, the method furtherincludes: receiving, by the service capability middleware, a subjectresource update request, where the subject resource update requestincludes a representation of a new subject resource and a uniformresource identifier of the subject resource to be updated, where therepresentation of the new subject resource includes information about anoperation resource associated with the new subject resource, andupdating, by the service capability middleware, the storedrepresentation of the subject resource to the representation of the newsubject resource according to the uniform resource identifier of thesubject resource to be updated. In an embodiment, before the retrieving,by the service capability middleware, a change result of the content ofthe subject resource stored in the service capability middleware, themethod further includes: receiving, by the service capabilitymiddleware, an operation resource create request, where the operationresource create request includes the representation of the operationresource associated with the subject resource and the uniform resourceidentifier of the operation resource set to which the operation resourceassociated with the subject resource belongs, and adding, by the servicecapability middleware, the representation of the operation resource tothe operation resource set according to the uniform resource identifierof the operation resource set to which the operation resource belongs.

With reference to the first aspect or the first or second possibleimplementation manner, in a third possible implementation manner, therepresentation of the operation resource further includes a type of theoperation request and an input parameter of the operation request, wherethe type of the operation request is create or update. When the inputparameter is a uniform resource identifier of a parameter resource, theconstructing the operation request for the object resource includes:retrieving, by the service capability middleware, a representation of anew object resource from the parameter resource that is pointed to bythe uniform resource identifier of the parameter resource, andconstructing the operation request that includes the uniform resourceidentifier of the object resource and the representation of the newobject resource and that is for the object resource in therepresentation of the operation resource. In an embodiment, when theinput parameter is a representation of a new object resource, theconstructing the operation request for the object resource includes:constructing, by the service capability middleware, the operationrequest that includes the uniform resource identifier of the objectresource and the representation of the new object resource and that isfor the object resource in the representation of the operation resource.

With reference to the first aspect or any one of the first to the thirdpossible implementation manners, in a fourth possible implementationmanner, before the retrieving, by the service capability middleware, achange result of the content of the subject resource stored in theservice capability middleware, the method further includes: receiving,by the service capability middleware, an operation resource updaterequest, where the operation resource update request includes arepresentation of a new operation resource, where the representation ofthe new operation resource includes a representation of a dependencyresource or a uniform resource identifier of a dependency resource, andupdating, by the service capability middleware, the storedrepresentation of the operation resource to the representation of thenew operation resource. In an embodiment, before the retrieving, by theservice capability middleware, a change result of the content of thesubject resource stored in the service capability middleware, the methodfurther includes: receiving, by the service capability middleware, adependency resource create request, where the dependency resource createrequest includes a representation of a dependency resource and a uniformresource identifier of a dependency resource set to which the dependencyresource belongs, saving, by the service capability middleware, therepresentation of the dependency resource to the dependency resource setaccording to the uniform resource identifier of the dependency resourceset to which the dependency resource belongs, and adding the uniformresource identifier of the dependency resource set to the representationof the operation resource.

With reference to the fourth possible implementation manner, in a fifthpossible implementation manner, before the constructing, by the servicecapability middleware, the operation request for the object resource,the method includes: retrieving, by the service capability middlewareaccording to the representation of the operation resource, therepresentation of the dependency resource associated with the operationresource; retrieving, by the service capability middleware, arepresentation of a condition resource that is pointed to by a uniformresource identifier in the representation of the dependency resource;and determining, by the service capability middleware according to therepresentation of the condition resource, that a condition in therepresentation of the dependency resource is met.

With reference to the fifth possible implementation manner, in a sixthpossible implementation manner, types of the dependency resource areclassified into a sufficient condition type and a necessary conditiontype, and a dependency resource quantity is at least one. Before theconstructing, by the service capability middleware, the operationrequest for the object resource in the representation of the operationresource, the method further includes: determining that a conditionspecified by at least one dependency resource of the sufficientcondition type is met, or determining that conditions specified by alldependency resources of the necessary condition type are met.

With reference to the fifth possible implementation manner, in a seventhpossible implementation manner, the retrieving, by the servicecapability middleware according to the representation of the operationresource, the representation of the dependency resource associated withthe operation resource, includes: retrieving, by the service capabilitymiddleware according to the representation of the dependency resourceincluded in the representation of the operation resource, therepresentation of the dependency resource associated with the operationresource. In an embodiment, the retrieving, by the service capabilitymiddleware according to the representation of the operation resource,the representation of the dependency resource associated with theoperation resource, includes: retrieving, by the service capabilitymiddleware according to the uniform resource identifier of thedependency resource included in the representation of the operationresource, the representation of the dependency resource associated withthe operation resource. In an embodiment, the retrieving, by the servicecapability middleware according to the representation of the operationresource, the representation of the dependency resource associated withthe operation resource, includes: retrieving, by the service capabilitymiddleware according to the uniform resource identifier, included in therepresentation of the operation resource, of the dependency resource setto which the dependency resource belongs, the representation of thedependency resource associated with the operation resource, where therepresentation of the dependency resource associated with the operationresource is a representation of a dependency resource included in thedependency resource set.

With reference to the first aspect or any one of the foregoing possibleimplementation manners, in an eighth possible implementation manner, itis determined that at least two operation resources are associated withthe subject resource, where representations of the operation resourcesfurther include priorities. The constructing, by the service capabilitymiddleware, the operation request for the object resource in therepresentation of the operation resource, includes: constructing, by theservice capability middleware, an operation request for an objectresource in the representation of each operation resource in sequenceaccording to the priorities in the representations of the operationresources.

With reference to the first aspect or any one of the foregoing possibleimplementation manners, in a ninth possible implementation manner, therepresentation of the operation resource further includes an operationexecution result, and the method further includes: receiving, by theservice capability middleware, an operation response returned by adevice that the object resource is located, and saving the operationresponse into the operation execution result in the representation ofthe operation resource. In an embodiment, the representation of theoperation resource further includes an address reflecting an operationexecution result and the operation execution result, and the methodfurther includes: receiving, by the service capability middleware, anoperation response returned by a device that the object resource islocated, retrieving, according to the address reflecting the operationexecution result, an operation result corresponding to the operationrequest, and saving the operation result corresponding to the operationrequest into the operation execution result.

A second aspect of embodiments of the present invention provides anoperation triggering apparatus for machine-to-machine communications,including a retrieving module, a constructing module, and a sendingmodule. The retrieving module is configured to retrieve a change resultof content of a subject resource stored in a service capabilitymiddleware when the content of the subject resource is changed. Theretrieving module is also configured to retrieve, according toinformation about an operation resource associated with the subjectresource, a representation of the operation resource associated with thesubject resource. The representation of the operation resource includesa condition for sending an operation request to an object resource and auniform resource identifier of the object resource. The servicecapability middleware stores a representation of the subject resource,where the representation of the subject resource includes the content ofthe subject resource and the information about the operation resourceassociated with the subject resource. The retrieving module is furtherconfigured to send the change result and the representation of theoperation resource to the constructing module. The constructing moduleis configured to receive the change result and the representation of theoperation resource associated with the subject resource, and when it isdetermined that the change result meets the condition for sending theoperation request to the object resource in the representation of theoperation resource, construct the operation request for the objectresource, and send the operation request to the sending module. Thesending module is configured to receive the operation request, and sendthe operation request to the object resource according to the uniformresource identifier of the object resource.

With reference to the second aspect of embodiments of the presentinvention, in a first possible implementation manner, the informationabout the operation resource associated with the subject resource is therepresentation of the operation resource associated with the subjectresource, and the retrieving module retrieving, according to informationabout an operation resource associated with the subject resource, arepresentation of the operation resource associated with the subjectresource, comprises the retrieving module retrieving, according to therepresentation, included in the representation of the subject resource,of the operation resource associated with the subject resource, therepresentation of the operation resource associated with the subjectresource. In an embodiment, the information about the operation resourceassociated with the subject resource is a uniform resource identifier ofthe operation resource associated with the subject resource, and theretrieving module retrieving, according to information about anoperation resource associated with the subject resource, arepresentation of the operation resource associated with the subjectresource, comprises: the retrieving module retrieving, according to theuniform resource identifier of the operation resource included in therepresentation of the subject resource, the representation of theoperation resource associated with the subject resource. In anembodiment, the information about the operation resource associated withthe subject resource is a uniform resource identifier of an operationresource set to which the operation resource associated with the subjectresource belongs, and the retrieving module retrieving, according toinformation about an operation resource associated with the subjectresource, a representation of the operation resource associated with thesubject resource, comprises: the retrieving module retrieving, accordingto the uniform resource identifier, included in the representation ofthe subject resource, of the operation resource set to which theoperation resource belongs, the representation of the operation resourceassociated with the subject resource, where the representation of theoperation resource associated with the subject resource is arepresentation of an operation resource included in the operationresource set.

With reference to the second aspect of embodiments of the presentinvention or the first possible implementation manner, in a secondpossible implementation manner, the apparatus further includes areceiving module. The receiving module is configured to receive asubject resource update request before the retrieving module retrievesthe change result of the content of the subject resource stored in theapparatus. The subject resource update request includes a representationof a new subject resource and a uniform resource identifier of thesubject resource to be updated. The representation of the new subjectresource includes information about an operation resource associatedwith the new subject resource. The receiving module updates the storedrepresentation of the subject resource to the representation of the newsubject resource according to the uniform resource identifier of thesubject resource to be updated. In an embodiment, the receiving moduleis configured to receive an operation resource create request before theretrieving module retrieves the change result of the content of thesubject resource stored in the apparatus. The operation resource createrequest includes the representation of the operation resource associatedwith the subject resource and the uniform resource identifier of theoperation resource set to which the operation resource belongs. Thereceiving module adds the representation of the operation resource tothe operation resource set according to the uniform resource identifierof the operation resource set to which the operation resource belongs.

With reference to the second aspect or the first or second possibleimplementation manner, in a third possible implementation manner, therepresentation of the operation resource further includes a type of theoperation request and an input parameter of the operation request, wherethe type of the operation request is create or update. When the inputparameter is a uniform resource identifier of a parameter resource, theconstructing module constructs the operation request for the objectresource comprises the construction module: retrieving a representationof a new object resource from the parameter resource that is pointed toby the uniform resource identifier of the parameter resource, andconstructing the operation request that includes the uniform resourceidentifier of the object resource and the representation of the newobject resource and that is for the object resource in therepresentation of the operation resource. In an embodiment, when theinput parameter is a representation of a new object resource, theconstructing module constructs the operation request for the objectresource comprises the constructing module: constructing the operationrequest that includes the uniform resource identifier of the objectresource and the representation of the new object resource and that isfor the object resource in the representation of the operation resource.

With reference to the second aspect or any one of the first to the thirdpossible implementation manners, in a fourth possible implementationmanner, the receiving module is further configured to receive anoperation resource update request before the retrieving module retrievesthe change result of the content of the subject resource stored in theservice capability middleware. The operation resource update requestincludes a representation of a new operation resource, where therepresentation of the new operation resource includes a representationof a dependency resource or a uniform resource identifier of adependency resource. The receiving module is also configured to updatethe stored representation of the operation resource to therepresentation of the new operation resource. In an embodiment, thereceiving module is further configured to receive a dependency resourcecreate request before the retrieving module retrieves the change resultof the content of the subject resource stored in the service capabilitymiddleware. The dependency resource create request includes arepresentation of a dependency resource and a uniform resourceidentifier of a dependency resource set to which the dependency resourcebelongs. The receiving module is also configured to save therepresentation of the dependency resource to the dependency resource setaccording to the uniform resource identifier of the dependency resourceset to which the dependency resource belongs, and add the uniformresource identifier of the dependency resource set to the representationof the operation resource.

With reference to the fourth possible implementation manner, in a fifthpossible implementation manner, the apparatus may further include adetermining module. The retrieving module is further configured toretrieve, according to the representation of the operation resource, therepresentation of the dependency resource associated with the operationresource, retrieve a representation of a condition resource that ispointed to by a uniform resource identifier in the representation of thedependency resource, and send the representation of the conditionresource and a condition in the representation of the dependencyresource to the determining module. The determining module is configuredto receive the representation of the condition resource, and determine,according to the representation of the condition resource, that thecondition in the representation of the dependency resource is met.

With reference to the fifth possible implementation manner, in a sixthpossible implementation manner, types of the dependency resource areclassified into a sufficient condition type and a necessary conditiontype, and a dependency resource quantity is at least one. Before theconstructing module constructs the operation request for the objectresource in the representation of the operation resource, thedetermining module is further configured to determine that a conditionspecified by at least one dependency resource of the sufficientcondition type is met. In an embodiment, before the constructing moduleconstructs the operation request for the object resource in therepresentation of the operation resource, the determining module isfurther configured to determine that conditions specified by alldependency resources of the necessary condition type are met, and theservice capability middleware constructs the operation request for theobject resource in the representation of the operation resource.

With reference to the fifth possible implementation manner, in a seventhpossible implementation manner, the retrieving module furtherretrieving, according to the representation of the operation resource,the representation of the dependency resource associated with theoperation resource, comprises the retrieving module: retrieving,according to the representation of the dependency resource included inthe representation of the operation resource, the representation of thedependency resource associated with the operation resource. In anembodiment, the retrieving module further retrieving, according to therepresentation of the operation resource, the representation of thedependency resource associated with the operation resource, comprisesthe retrieving module: retrieving, according to the uniform resourceidentifier of the dependency resource included in the representation ofthe operation resource, the representation of the dependency resourceassociated with the operation resource. In an embodiment, the retrievingmodule further retrieving, according to the representation of theoperation resource, the representation of the dependency resourceassociated with the operation resource, comprises the retrieving module:retrieving, according to the uniform resource identifier included in therepresentation of the operation resource, of the dependency resource setto which the dependency resource belongs, the representation of thedependency resource associated with the operation resource, where therepresentation of the dependency resource associated with the operationresource is a representation of a dependency resource included in thedependency resource set.

With reference to the second aspect or any one of the foregoing possibleimplementation manners, in an eighth possible implementation manner, itis determined that at least two operation resources are associated withthe subject resource. That is, in the operation triggering apparatus formachine-to-machine communications, at least two operation resources areassociated with the subject resource. Representations of the operationresources further include priorities. The constructing moduleconstructing the operation request for the object resource in therepresentation of the operation resource comprises the constructingmodule: constructing an operation request for an object resource in therepresentation of each operation resource in sequence according to thepriorities in the representations of the operation resources.

With reference to the second aspect or any one of the foregoing possibleimplementation manners, in a ninth possible implementation manner, therepresentation of the operation resource further includes an operationexecution result. The receiving module is further configured to receivean operation response returned by the device in which the objectresource is located, and save the operation response into the operationexecution result in the representation of the operation resource. In anembodiment, the representation of the operation resource furtherincludes an address reflecting an operation execution result and theoperation execution result, and the receiving module is furtherconfigured to receive an operation response returned by the device inwhich the object resource is located, and the retrieving module isfurther configured to retrieve, according to the address reflecting theoperation execution result, an operation result corresponding to theoperation request, and save the operation result corresponding to theoperation request into the operation execution result.

A third aspect of embodiments of the present invention provides anotheroperation triggering apparatus for machine-to-machine communications.The apparatus includes a network interface, a processor, and a memory.The network interface is configured to perform communication with anexternal device. The memory is configured to store an applicationprogram. The processor is configured to invoke the application programstored in the memory. The program includes instructions for, whencontent of a subject resource is changed, retrieving a change result ofthe content of the subject resource stored in the service capabilitymiddleware, and retrieving, according to information about an operationresource associated with the subject resource, a representation of theoperation resource associated with the subject resource, where therepresentation of the operation resource includes a condition forsending an operation request to an object resource and a uniformresource identifier of the object resource. The program further includesinstructions for, when it is determined that the change result meets thecondition for sending the operation request to the object resource inthe representation of the operation resource, constructing the operationrequest for the object resource, where the service capability middlewarestores a representation of the subject resource, and the representationof the subject resource includes the content of the subject resource andthe information about the operation resource associated with the subjectresource. The network interface is further configured to send theoperation request to the object resource according to the uniformresource identifier of the object resource.

With reference to the third aspect of embodiments of the presentinvention, in a first possible implementation manner, the informationabout the operation resource associated with the subject resource is therepresentation of the operation resource associated with the subjectresource. In an embodiment, the processor retrieving, according to therepresentation of the subject resource, a representation of theoperation resource associated with the subject resource, comprises theprocessor being configured to: retrieve, according to the representationof the operation resource included in the representation of the subjectresource, the representation of the operation resource associated withthe subject resource. In an embodiment, the information about theoperation resource associated with the subject resource is a uniformresource identifier of the operation resource associated with thesubject resource, and the processor being configured to retrieve,according to the representation of the subject resource, arepresentation of the operation resource associated with the subjectresource, comprises the processor being configured to: retrieve,according to the uniform resource identifier of the operation resourceincluded in the representation of the subject resource, therepresentation of the operation resource associated with the subjectresource. In an embodiment, the information about the operation resourceassociated with the subject resource is a uniform resource identifier ofan operation resource set to which the operation resource associatedwith the subject resource belongs, and the processor being configured toretrieve, according to the representation of the subject resource, arepresentation of the operation resource associated with the subjectresource, comprises the processor being configured to: retrieve,according to the uniform resource identifier, included in therepresentation of the subject resource, of the operation resource set towhich the operation resource belongs, the representation of theoperation resource associated with the subject resource, where therepresentation of the operation resource associated with the subjectresource is a representation of an operation resource included in theoperation resource set.

With reference to the third aspect of embodiments of the presentinvention or the first possible implementation manner, in a secondpossible implementation manner, the network interface is furtherconfigured to receive a subject resource update request. The subjectresource update request includes a representation of a new subjectresource and a uniform resource identifier of the subject resource to beupdated. The representation of the new subject resource includesinformation about an operation resource associated with the new subjectresource. The processor is configured to invokes the application programstored in the memory to update the stored representation of the subjectresource to the representation of the new subject resource according tothe uniform resource identifier of the subject resource to be updated.In an embodiment, the network interface is further configured to receivean operation resource create request, where the operation resourcecreate request includes the representation of the operation resourceassociated with the subject resource and the uniform resource identifierof the operation resource set to which the operation resource associatedwith the subject resource belongs, and the processor invokes theapplication program stored in the memory to add the representation ofthe operation resource to the operation resource set according to theuniform resource identifier of the operation resource set to which theoperation resource belongs.

With reference to the third aspect or the first or second possibleimplementation manner, in a third possible implementation manner, therepresentation of the operation resource further includes a type of theoperation request and an input parameter of the operation request, wherethe type of the operation request is create or update. When the inputparameter is a uniform resource identifier of a parameter resource, theprocessor retrieves a representation of a new object resource from theparameter resource that is pointed to by the uniform resource identifierof the parameter resource, and constructs the operation request thatincludes the uniform resource identifier of the object resource and therepresentation of the new object resource and that is for the objectresource in the representation of the operation resource. In anembodiment, when the input parameter is a representation of a new objectresource, the processor constructs the operation request that includesthe uniform resource identifier of the object resource and therepresentation of the new object resource and that is for the objectresource in the representation of the operation resource.

With reference to the third aspect or any one of the first to the thirdpossible implementation manners, in a fourth possible implementationmanner, the network interface is further configured to receive anoperation resource update request. The operation resource update requestincludes a representation of a new operation resource. Therepresentation of the new operation resource includes a representationof a dependency resource or a uniform resource identifier of adependency resource. The processor invokes the application programstored in the memory to update the stored representation of theoperation resource to the representation of the new operation resource.In an embodiment, the network interface is further configured to receivea dependency resource create request. The dependency resource createrequest includes a representation of a dependency resource and a uniformresource identifier of a dependency resource set to which the dependencyresource belongs. The processor invokes the application program storedin the memory to save the representation of the dependency resource tothe dependency resource set according to the uniform resource identifierof the dependency resource set to which the dependency resource belongs,and add the uniform resource identifier of the dependency resource setto the representation of the operation resource.

With reference to the fourth possible implementation manner, in a fifthpossible implementation manner, the processor further retrieves,according to the representation of the operation resource, therepresentation of the dependency resource associated with the operationresource, retrieves a representation of a condition resource that ispointed to by a uniform resource identifier in the representation of thedependency resource, and determines, according to the representation ofthe condition resource, that a condition in the representation of thedependency resource is met.

With reference to the fifth possible implementation manner, in a sixthpossible implementation manner, types of the dependency resource areclassified into a sufficient condition type and a necessary conditiontype, and a dependency resource quantity is at least one. Beforeconstructing the operation request for the object resource in therepresentation of the operation resource, the processor furtherdetermines that a condition specified by at least one dependencyresource of the sufficient condition type is met, or determines thatconditions specified by all dependency resources of the necessarycondition type are met.

With reference to the fifth possible implementation manner, in a seventhpossible implementation manner, the processor retrieves, according tothe representation of the dependency resource included in therepresentation of the operation resource, the representation of thedependency resource associated with the operation resource. In anembodiment, the processor retrieves, according to the uniform resourceidentifier of the dependency resource included in the representation ofthe operation resource, the representation of the dependency resourceassociated with the operation resource; or retrieves, according to theuniform resource identifier, included in the representation of theoperation resource, of the dependency resource set to which thedependency resource belongs, the representation of the dependencyresource associated with the operation resource, where therepresentation of the dependency resource associated with the operationresource is a representation of a dependency resource included in thedependency resource set.

With reference to the third aspect or any one of the foregoing possibleimplementation manners, in an eighth possible implementation manner, atleast two operation resources are associated with the subject resource,representations of the operation resources further include priorities,and the processor constructs an operation request for an object resourcein the representation of each operation resource in sequence accordingto the priorities in the representations of the operation resources.

With reference to the third aspect or any one of the foregoing possibleimplementation manners, in a ninth possible implementation manner, therepresentation of the operation resource further includes an operationexecution result. The network interface is further configured to receivean operation response returned by the device in which the objectresource is located. The processor saves the operation response into theoperation execution result in the representation of the operationresource. In an embodiment, the representation of the operation resourcefurther includes an address reflecting an operation execution result andthe operation execution result. The network interface is furtherconfigured to receive an operation response returned by the device thatthe object resource is located. The processor retrieves, according tothe address reflecting the operation execution result, an operationresult corresponding to the operation request, and saves the operationresult corresponding to the operation request into the operationexecution result.

The service capability middleware in the foregoing embodiments of thepresent invention may be middleware on an M2M platform or a gateway.Both the M2M platform and the gateway are nodes having capabilities in anetwork. Therefore a problem of capability restriction does not exist,which is advantageous for handling situations in which services cannotbe performed in restricted environments. In addition, in the foregoingembodiments of the present invention, the representation of theoperation resource associated with the subject resource can be retrievedaccording to the representation of the subject resource. As such,operation triggering relationships between resources may be distributedon each node (the M2M platform or the gateway), thereby avoidingcomplexity of a single application program. The technical solutionsprovided by the foregoing embodiments of the present invention canenhance capabilities of the middleware on the M2M platform and thegateway, so that it is possible to deploy richer applications.Introduction of the operation resource makes operation triggering moreapplicable to a RESTful architecture.

BRIEF DESCRIPTION OF THE DRAWINGS

To describe the technical solutions in the embodiments of the presentinvention more clearly, the following briefly introduces theaccompanying drawings required for describing the embodiments.Apparently, the accompanying drawings in the following description showsome embodiments of the present invention, and persons of ordinary skillin the art may still derive other drawings from these accompanyingdrawings without creative efforts.

FIG. 1 is a schematic flowchart of an operation triggering method forM2M according to an embodiment of the present invention;

FIG. 2 is a schematic diagram of a resource structure according to anembodiment of the present invention;

FIG. 3 is a schematic flowchart of an operation triggering methodaccording to a specific embodiment of the present invention;

FIG. 4 is a schematic flowchart of configuring operation triggeringaccording to an embodiment of the present invention;

FIG. 5 is architecture diagram 1 of an operation resource TurnOnACaccording to an embodiment of the present invention;

FIG. 6 is an architecture diagram of a dependency resource MemberAtHomeaccording to an embodiment of the present invention;

FIG. 7 is an architecture diagram of a system according to an embodimentof the present invention;

FIG. 8 is architecture diagram 1 of an operation resource CloseWindowaccording to an embodiment of the present invention;

FIG. 9 is a schematic diagram of an association between a subjectresource and operation resources according to an embodiment of thepresent invention;

FIG. 10 is a schematic flowchart of operation triggering according to anembodiment of the present invention;

FIG. 11 is a schematic flowchart of retrieving an input parameteraccording to an embodiment of the present invention;

FIG. 12 is architecture diagram 2 of an operation resource TurnOnACaccording to an embodiment of the present invention;

FIG. 13 is architecture diagram 2 of an operation resource CloseWindowaccording to an embodiment of the present invention;

FIG. 14 is a schematic flowchart of performing condition detectionaccording to a dependency resource according to an embodiment of thepresent invention;

FIG. 15 is a schematic flowchart of retrieving an operation resultaccording to an embodiment of the present invention;

FIG. 16 is schematic structural diagram 1 of an operation triggeringapparatus for machine-to-machine communications according to anembodiment of the present invention; and

FIG. 17 is schematic structural diagram 2 of an operation triggeringapparatus for machine-to-machine communications according to anembodiment of the present invention.

DETAILED DESCRIPTION OF ILLUSTRATIVE EMBODIMENTS

To make the objectives, technical solutions, and advantages of theembodiments of the present invention clearer, the following describesthe technical solutions in the embodiments of the present invention withreference to the accompanying drawings in the embodiments of the presentinvention. Apparently, the described embodiments are some but not all ofthe embodiments of the present invention. All other embodiments obtainedby persons of ordinary skill in the art based on the embodiments of thepresent invention without creative efforts shall fall within theprotection scope of the present invention.

In view of disadvantages of a high maintenance cost and poor stabilityof the operation triggering method for M2M in a current system, anembodiment of the present invention provides a technical solution, whereservice capability middleware stores a representation of a subjectresource. The representation of the subject resource includes content ofthe subject resource and information about an operation resourceassociated with the subject resource. As shown in FIG. 1 , an operationtriggering method for M2M according to the embodiment of the presentinvention includes the following steps.

Step 101: When the content of the subject resource is changed, theservice capability middleware retrieves a change result of the contentof the subject resource stored in the service capability middleware.

Step 102: The service capability middleware retrieves, according to theinformation about the operation resource associated with the subjectresource, a representation of the operation resource associated with thesubject resource. The representation of the operation resource includesa condition for sending an operation request to an object resource and auniform resource identifier of the object resource.

Step 103: The service capability middleware constructs the operationrequest for the object resource when determining that the change resultmeets the condition for sending the operation request to the objectresource in the representation of the operation resource.

Step 104: The service capability middleware sends the operation requestto the object resource according to the uniform resource identifier ofthe object resource.

In the technical solution provided by the foregoing embodiment of thepresent invention, when the content of the subject resource is changed,the service capability middleware storing the change result of thecontent of the subject resource retrieves, according to the informationabout the operation resource associated with the subject resource, therepresentation of the operation resource associated with the subjectresource, constructs the operation request for the object resource inthe representation of the operation resource, and sends the operationrequest to the object resource in the representation of the operationresource.

The service capability middleware in the foregoing embodiment of thepresent invention may be middleware on an M2M platform or gateway. Boththe M2M platform and the gateway are nodes having capabilities in anetwork. Therefore a problem of capability restriction does not exist,which is advantageous for handling situations in which services cannotbe performed in restricted environments. In addition, in the foregoingembodiment of the present invention, the representation of the operationresource associated with the subject resource can be retrieved accordingto the information about the operation resource associated with thesubject resource. That is, an association is established between thesubject resource and the operation resource, so that operationtriggering relationships between resources may be distributed on eachnode (the M2M platform or the gateway), for example, on each nodestoring a subject resource, thereby avoiding complexity of a singleapplication program. For example, an operation of turning off an airconditioner may be used as an operation resource, while detectingwhether a master is at home and detecting an indoor temperature mayseparately exist as a subject resource. According to the embodiment ofthe present invention, the operation resource of turning off the airconditioner may be saved to service capability middleware on a gatewayto which the air conditioner belongs, while the two subject resources ofdetecting whether the host is at home and detecting the indoortemperature are separately saved to service capability middleware ondifferent gateways. By establishing an association between the subjectresources and the operation resource distributed on different platforms,an operation triggering function may also be implemented. The technicalsolution provided by the embodiment of the present invention can enhancecapabilities of the middleware on the M2M platform and the gateway, sothat it is possible to deploy richer applications. Introduction of theoperation resource makes operation triggering more applicable to aRESTful architecture.

In the foregoing embodiment of the present invention, the informationabout the operation resource associated with the subject resource is therepresentation of the operation resource associated with the subjectresource. The service capability middleware retrieving, according to theinformation about the operation resource associated with the subjectresource, a representation of the operation resource associated with thesubject resource in step 102, may include: retrieving, by the servicecapability middleware according to the representation, included in therepresentation of the subject resource, of the operation resourceassociated with the subject resource, the representation of theoperation resource associated with the subject resource. In anembodiment, the information about the operation resource associated withthe subject resource is a uniform resource identifier of the operationresource associated with the subject resource, and the servicecapability middleware retrieving, according to the information about theoperation resource associated with the subject resource, arepresentation of the operation resource associated with the subjectresource, includes: retrieving, by the service capability middlewareaccording to the uniform resource identifier of the operation resourceincluded in the representation of the subject resource, therepresentation of the operation resource associated with the subjectresource. In an embodiment, the information about the operation resourceassociated with the subject resource is a uniform resource identifier ofan operation resource set to which the operation resource associatedwith the subject resource belongs, and the service capability middlewareretrieving, according to the information about the operation resourceassociated with the subject resource, a representation of the operationresource associated with the subject resource, includes: retrieving, bythe service capability middleware according to the uniform resourceidentifier, included in the representation of the subject resource, ofthe operation resource set to which the operation resource belongs, therepresentation of the operation resource associated with the subjectresource, where the representation of the operation resource associatedwith the subject resource is a representation of an operation resourceincluded in the operation resource set.

That is, the association between the subject resource and the operationresource may be established in three manners: the representation of thesubject resource includes the representation of the operation resource,the representation of the subject resource includes the uniform resourceidentifier of the operation resource, or the representation of thesubject resource includes the uniform resource identifier of theoperation resource set to which the operation resource belongs.

In the foregoing embodiment of the present invention, before the servicecapability middleware retrieves the change result of the content of thesubject resource stored in the service capability middleware in step101, the method further includes: receiving, by the service capabilitymiddleware, a subject resource update request, where the subjectresource update request includes a representation of a new subjectresource and a uniform resource identifier of the subject resource to beupdated. The representation of the new subject resource includesinformation about an operation resource associated with the new subjectresource. The method further includes: updating, by the servicecapability middleware, the stored representation of the subject resourceto the representation of the new subject resource according to theuniform resource identifier of the subject resource to be updated, whereit should be noted that the subject resource update request furtherincludes the representation of the subject resource before the update inaddition to the representation of the operation resource or the uniformresource identifier of the operation resource. In an embodiment, themethod further includes receiving, by the service capability middleware,an operation resource create request, where the operation resourcecreate request includes the representation of the operation resourceassociated with the subject resource and the uniform resource identifierof the operation resource set to which the operation resource associatedwith the subject resource belongs, and adding, by the service capabilitymiddleware, the representation of the operation resource to theoperation resource set according to the uniform resource identifier ofthe operation resource set to which the operation resource belongs.

In addition, in the foregoing embodiment of the present invention, therepresentation of the operation resource may further include a type ofthe operation request, while the type of the constructed operationrequest may be any one of create, update, retrieve, and delete. When thetype of the operation request is create or update, that is, when theoperation request is used to create or update a representation of anobject resource, the create operation request further needs to carry arepresentation of a new object resource for the operation resource.Specifically, the representation of the operation resource may furtherinclude an input parameter of the operation request, where the inputparameter of the operation request may be a URI of a parameter resource,or the representation of the new object resource is directly saved inthe input parameter of the operation request.

In an embodiment, when the input parameter is the uniform resourceidentifier of the parameter resource, the constructing the operationrequest for the object resource includes: retrieving, by the servicecapability middleware, the representation of the new object resourcefrom the parameter resource that is pointed to by the uniform resourceidentifier of the parameter resource, and constructing the operationrequest that includes the uniform resource identifier of the objectresource and the representation of the new object resource and that isfor the object resource in the representation of the operation resource.In an embodiment, when the input parameter is the representation of thenew object resource, the constructing the operation request for theobject resource includes: constructing, by the service capabilitymiddleware, the operation request that includes the uniform resourceidentifier of the object resource and the representation of the newobject resource and that is for the object resource in therepresentation of the operation resource.

In the foregoing embodiment of the present invention, before the servicecapability middleware retrieves the change result of the content of thesubject resource stored in the service capability middleware, the methodfurther includes: receiving, by the service capability middleware, anoperation resource update request, where the operation resource updaterequest includes a representation of a new operation resource. Therepresentation of the new operation resource includes a representationof a dependency resource or a uniform resource identifier of adependency resource. The method further includes updating, by theservice capability middleware, the stored representation of theoperation resource to the representation of the new operation resource.It should be noted that the operation resource update request furtherincludes the representation of the operation resource before the updatein addition to the representation of the dependency resource or theuniform resource identifier of the dependency resource. In anembodiment, the method further includes receiving, by the servicecapability middleware, a dependency resource create request, where thedependency resource create request includes a representation of adependency resource and a uniform resource identifier of a dependencyresource set to which the dependency resource belongs, saving, by theservice capability middleware, the representation of the dependencyresource to the dependency resource set according to the uniformresource identifier of the dependency resource set to which thedependency resource belongs, and adding the uniform resource identifierof the dependency resource set to the representation of the operationresource.

In the foregoing embodiment of the present invention, when thedependency resource exists, before the service capability middlewareconstructs the operation request for the object resource in theforegoing embodiment of the present invention, the method includes:retrieving, by the service capability middleware according to therepresentation of the operation resource, the representation of thedependency resource associated with the operation resource; retrieving,by the service capability middleware, a representation of a conditionresource that is pointed to by a uniform resource identifier in therepresentation of the dependency resource; and determining, by theservice capability middleware according to the representation of thecondition resource, that a condition in the representation of thedependency resource is met.

In an embodiment, types of the foregoing dependency resource may beclassified into a sufficient condition type and a necessary conditiontype, a dependency resource quantity is at least one, and before theservice capability middleware constructs the operation request for theobject resource in the representation of the operation resource, themethod further includes: determining that a condition specified by atleast one dependency resource of the sufficient condition type is met;or determining that conditions specified by all dependency resources ofthe necessary condition type are met.

That is, when further determining that the condition specified by the atleast one dependency resource of the sufficient condition type is met,the service capability middleware constructs the operation request forthe object resource in the representation of the operation resource. Inan embodiment, when further determining that the conditions specified byall the dependency resources of the necessary condition type are met,the service capability middleware constructs the operation request forthe object resource in the representation of the operation resource.

In an embodiment, the retrieving, by the service capability middlewareaccording to the representation of the operation resource, therepresentation of the dependency resource associated with the operationresource, includes: retrieving, by the service capability middlewareaccording to the representation of the dependency resource included inthe representation of the operation resource, the representation of thedependency resource associated with the operation resource. In anembodiment, the retrieving, by the service capability middlewareaccording to the representation of the operation resource, therepresentation of the dependency resource associated with the operationresource, includes: retrieving, by the service capability middlewareaccording to the uniform resource identifier of the dependency resourceincluded in the representation of the operation resource, therepresentation of the dependency resource associated with the operationresource. In an embodiment, the retrieving, by the service capabilitymiddleware according to the representation of the operation resource,the representation of the dependency resource associated with theoperation resource, includes: retrieving, by the service capabilitymiddleware according to the uniform resource identifier, included in therepresentation of the operation resource, of the dependency resource setto which the dependency resource belongs, the representation of thedependency resource associated with the operation resource, where therepresentation of the dependency resource associated with the operationresource is a representation of a dependency resource included in thedependency resource set.

That is, the association between the operation resource and thedependency resource may be established in three manners: therepresentation of the operation resource includes the representation ofthe dependency resource, the representation of the operation resourceincludes the uniform resource identifier of the dependency resource, andthe representation of the operation resource includes the uniformresource identifier of the dependency resource set to which thedependency resource belongs.

In the foregoing embodiment of the present invention, it is determinedthat at least two operation resources are associated with the subjectresource, where representations of the operation resources may furtherinclude priorities, and the constructing, by the service capabilitymiddleware, the operation request for the object resource in therepresentation of the operation resource may include: constructing, bythe service capability middleware, an operation request for an objectresource in the representation of each operation resource in sequenceaccording to the priorities in the representations of the operationresources.

In the foregoing embodiment of the present invention, the representationof the operation resource may further include an operation executionresult, and the method further includes: receiving, by the servicecapability middleware, an operation response returned by the device inwhich the object resource is located, and saving the operation responseinto the operation execution result in the representation of theoperation resource. In an embodiment, the representation of theoperation resource may further include an address reflecting anoperation execution result and the operation execution result, and themethod further includes: receiving, by the service capabilitymiddleware, an operation response returned by the device in which theobject resource is located, retrieving, according to the addressreflecting the operation execution result, an operation resultcorresponding to the operation request, and saving the operation resultcorresponding to the operation request into the operation executionresult, where specifically, the address reflecting the operationexecution result may be a URI of a resource, the corresponding resourcemay be accessed according to the URI, and the operation resultcorresponding to the operation request is retrieved.

The operation triggering method according to the present invention ishereinafter further described in detail in a specific embodiment. FIG. 2is a schematic diagram of a resource structure according to anembodiment of the present invention. In this embodiment, a RESTfulresource element structure is extended, and multiple operation resourcesare combined to constitute an operation resource set.

A relationship between a subject resource, an operation resource, and anoperation resource set may be shown in FIG. 2 , where a rectangularblock represents a resource, a rounded rectangular block represents anattribute, and a black solid line indicates an association relationshipbetween two resources or between a resource and an attribute. Resourcesand attributes in this embodiment represent only an exemplary divisionmanner, and there may also be different division manners according todifferent application scenarios.

The subject resource may be any type of resource in a RESTfularchitecture. In this embodiment, the subject resource may be a resourcethat causes an operation triggering event.

The operation resource set includes one or more operation resourceswhere each operation resource corresponds to one operation triggered bythe subject resource. The operation resource set is associated with thesubject resource, and a manner of indicating the association may be thata representation of the subject resource includes a URI of the operationresource set.

The operation resource indicates an operation. The operation resourcemay include a series of attributes and resources. As described above, arounded rectangular block represents an attribute, that is, attributesof the operation resource are some or all of a priority, a condition(Rule), an object resource, a request type (Method), an input parameter(Input), an address reflecting an operation execution result (OutputURI), and the execution result (Result). Likewise, as described above, arectangular block represents a resource, that is, a resource in theoperation resource is a dependency resource included in a dependencyresource set (Dependencies). Specifically, the dependency resource mayfurther include several attributes, for example, logic, URI, and/or acondition. One or more operation resources are included in the operationresource set, and an association with the subject resource is generatedusing the operation resource set. That is, if the representation of thesubject resource includes the uniform resource identifier (URI) of theoperation resource set, all operation resources in the operationresource set are operation resources associated with the subjectresource. Therefore, when the subject resource changes, whetheroperations in the operation resources need to be executed is determinedfor all the operation resources in the operation resource set.

The priority indicates a priority of the operation resource. Whenmultiple operation resources, for example, two or more than two, areassociated with the subject resource, and operations in the multipleoperation resources need to be executed, service capability middlewareexecutes the operations in the operation resources in descending orderof priority according to the priorities in representations of theoperation resources.

The condition (Rule) indicates a condition required for executing anoperation in the operation resource. When a change result of content ofthe subject resource associated with the operation resource meets thecondition defined by Rule, the operation in the operation resource isexecuted.

The object resource may be indicated by using a URI of the objectresource. When the change result of the content of the subject resourceassociated with the operation resource meets the condition defined byRule in the representation of the operation resource, a common operationrequest for the object resource is sent to the URI of the objectresource.

Method indicates a type of an operation request for the operationresource. In the RESTful architecture, generally, finite types ofoperation requests are defined. For example, for ETSI M2M, there arefour types of operation requests, namely, create, retrieve, update, anddelete.

Input indicates an input parameter of the operation request for theoperation resource. In a RESTful method, operation requests of theupdate and create types need to carry the input parameter. In a createrequest, the input parameter carried in the create request is arepresentation of a new object resource, and the representation of thenew object resource carried in the create request is used to create theentire object resource. In an update request, a representation of a newobject resource carried in the update request is used to replace arepresentation of an original object resource. In an embodiment, a valueof the input parameter in the operation resource may further be a URI,where the URI points to a parameter resource, and a representation ofthe parameter resource is the representation of the new object resourcethat needs to be carried in the operation request. The input parametermay also be a text segment used to directly save the representation ofthe new object resource. The input parameter is not mandatory to eachoperation resource. When the type of the operation request is delete orretrieve, because the operation request does not need to carry the inputparameter, the representation of the operation resource of this type maynot carry the input parameter.

Output URI indicates an address reflecting an operation executionresult. In some scenarios, the operation execution result needs to befed back using a status of another resource. For example, to determinewhether a light is turned on, it is necessary to retrieve a value of alight sensor under the light, and an address of data of the light sensoris the address reflecting the operation execution result. The inputparameter is also not mandatory to each operation resource.Representations of operation resources of some types may not include theinput parameter.

Result indicates the operation execution result. It is a text segment.In a case in which Output URI exists, that is, when the operationexecution result is reflected by a resource pointed to by Output URI, arepresentation of the resource retrieved from Output URI is saved inResult. When Output URI is not provided, an operation response that isfed back after the operation request is sent is saved in Result.

Dependencies indicate a dependency resource (Dependency) set. Thedependency resource indicates execution of the operation resourcefurther needs to depend on a dependency condition defined by adependency resource.

Dependency indicates the dependency resource. Three attributes may besaved in the dependency resource. One is a URI, one is a condition(Rule), and the last one is logic. Specifically, the dependency resourceis used to determine whether a representation of a condition resourcepointed to by a URI in the dependency resource meets the conditiondefined by Rule in a representation of the dependency resource.Furthermore, if a parameter in Logic is AND, it indicates that meetingthe condition defined by Rule in the representation of the dependencyresource is a necessary condition for executing the sending of theoperation request. If the parameter in Logic is OR, it indicates thatmeeting the condition defined by Rule in the representation of thedependency resource is a sufficient condition for executing the sendingof the operation request.

With reference to the resource structure diagram shown in FIG. 2 , anembodiment of the present invention provides a complete flowchart of anoperation triggering method. FIG. 3 is a schematic flowchart of anoperation triggering method according to a specific embodiment of thepresent invention. As shown in FIG. 3 , the method includes thefollowing steps.

Step 201: Configure a subject resource, so that when content of thesubject resource is changed, an operation on an object resource istriggered.

According to a service requirement of an M2M application, an applicationprogram may configure a subject resource, so that when a content of thesubject resource is changed, one or more operations are performed on oneor more object resources. A configuration method is to associate atleast one operation resource with the subject resource. In anembodiment, the association may be established by using an operationresource set, or multiple operation resources may be directly associatedwith the subject resource, which is not limited herein in the embodimentof the present invention.

In an embodiment, for configuring the subject resource, it may be thatthe application program sends an operation resource create request tothe operation resource set associated with the subject resource, so thatan operation resource is created in the operation resource set. Theoperation resource create request defines what operation (Method) willbe performed on which object resource when what change (Rule) of thesubject resource occurs, an input parameter (Input) that needs to becarried in an operation request for the operation, and whether acondition defined by Rule in a dependency resource needs to be metbefore the operation is executed. In addition, it may also be that theapplication program sends the operation resource create request, and anentity (for example, platform middleware) that receives the operationresource create request creates the operation resource. It may furtherbe that the application program directly sends the operation resourcecreate request to middleware that stores the subject resource, and themiddleware creates the operation resource in the representation of thesubject resource. For a specific configuration process, reference may bemade to an embodiment shown in FIG. 4 .

Step 202: Retrieve a change result of the content of the subjectresource.

The subject resource may be any resource stored in service capabilitymiddleware of an M2M system. In an embodiment, the subject resource maybe a resource that causes an operation triggering event. For example, inan operation triggering event of turning on and off an air conditionercaused by an indoor temperature change, a resource that completes indoortemperature detection is the subject resource. In an embodiment, thecontent of the subject resource may be a text segment, a databaserecord, or a file that is stored in the service capability middlewareand has a specific structure. The stored text segment and the like maybe changed into a data structure by means of a deserialization process.The representation of the subject resource may also be a data structurethat is directly saved in a memory of the service capability middleware.

The change of the content of the subject resource may be caused by anysituation. For example, the content of the subject resource may bechanged by request sending by another application, or the content of thesubject resource is changed by a process in the service capabilitymiddleware. The service capability middleware that stores the subjectresource detects the change result of the content of the subjectresource by listening on a program of the subject resource.

Step 203: Retrieve representations of operation resources associatedwith the subject resource, and determine that the change result of thecontent of the subject resource meets conditions defined by rules in therepresentations of the operation resources.

As shown in FIG. 2 , the subject resource is associated with theoperation resources using the operation resource set.

However, in this embodiment, it may also be that the representation ofthe subject resource includes the representation of each operationresource in FIG. 2 , or the URI of each operation resource in FIG. 2 ,or the URI of the operation resource set to which the operationresources in FIG. 2 belong. The operation resource set is a resource ofa set type and includes at least one operation resource. Each operationresource includes a Rule attribute that defines a condition that thechange result of the content of the subject resource associated with theoperation resource needs to meet. The service capability middlewareperforms determining, one by one according to the change result of thecontent of the subject resource, on conditions in rules of the operationresources associated with the subject resource, and finally selectsthose operation resources in which conditions in rules are met. For aspecific implementation process of step 203, reference may be made to anembodiment shown in FIG. 10 .

Step 204: For the operation resources that are associated with thesubject resource and determined in the foregoing step, select anoperation resource according to priorities of the operation resources.

A priority attribute is defined in an operation resource and indicates apriority of the operation resource. In an embodiment, the priority maybe indicated in a form of a number, where a greater number indicates ahigher priority, or in other forms. Importance and a sequence of theoperation resources are arranged using the priorities.

In an embodiment, in step 203, it is determined that at least twooperation resources are associated with the subject resource, and thechange result of the content of the subject resource meets conditions inrules in the operation resources. Then in this step, the servicecapability middleware constructs an operation request for an objectresource in a representation of each operation resource in sequenceaccording to the priorities in the representations of the operationresources. In this manner, an operation described in each operationresource can be executed in sequence.

Step 205: Determine that dependency resources associated with theoperation resource that is selected according to the priorities in step204 exist, and determine that all conditions defined by rules in theassociated dependency resources can be met.

In an embodiment, for the operation resource selected in step 204, it isdetermined that the dependency resources associated with the operationresource exist. For example, the dependency resources associated withthe operation resource may be representations of the dependencyresources included in the representation of the operation resource (thedependency resources as shown in FIG. 2 ), or may be an identifier oridentifiers of one or more dependency resources included in therepresentation of the operation resource or an identifier of adependency resource set included in the representation of the operationresource, which is not limited herein in the embodiment of the presentinvention.

A dependency resource includes three attributes: URI, Logic, and Rule.After it is determined that the dependency resources associated with theoperation resource exist, the determining that all conditions defined byrules in the dependency resources can be met includes: retrieving,according to a URI of a dependency resource, a representation of acondition resource indicated by the URI; determining whether therepresentation of the condition resource can meet a condition defined byRule in the dependency resource; if the representation of the conditionresource can meet the condition defined by Rule in the dependencyresource, further checking whether a type of the dependency resourcedefined in Logic is a sufficient condition type or a necessary conditiontype; if it is the necessary condition type, continuing to check whetherconditions defined by rules in other unchecked dependency resources canbe met; and if it is the sufficient condition type, step 206 is executeddirectly. For a specific implementation process of this step, referencemay be made to an embodiment shown in FIG. 14 .

Step 206: Retrieve an input parameter of an operation request accordingto a type of the operation request in a representation of the operationresource selected in step 204, and construct the operation request.

In an embodiment, in this step, first, it is determined that the type ofthe operation request defined by Method in the representation of theoperation resource is create or update. The input parameter of theoperation request is retrieved according to a value of Input in theoperation resource. The input parameter of the operation request is arepresentation of an object resource to be created or a representationof an object resource to be updated. When Input includes a URI, arepresentation of a resource indicated by the URI needs to be retrievedby using a retrieve request and used as the representation of the newobject resource. The representation of the new object resource may alsobe saved directly as the value of Input. In this case, therepresentation of the new object resource is directly used to constructthe operation request.

The operation request to be sent is constructed according to the type ofthe operation request, the object resource, and the input parameterdefined in the operation resource. For a specific implementation processof step 206, reference may be made to an embodiment shown in FIG. 11 .

Step 207: Send the operation request constructed in step 206 to a URI ofan object resource, and receive an operation response returned by adevice in which the object resource is located. In an embodiment,interaction between platform middleware that stores the subject resourceand the device that stores the object resource may be performed by usinga standard RESTful interface.

Step 208: According to Output URI in the representation of the operationresource that is currently executed, retrieve an execution resultcorresponding to the operation request, and save it to Result.

In an embodiment, when the representation of the operation resourceincludes Output URI, the execution result corresponding to the operationrequest needs to be retrieved from a resource indicated by Output URI.After the request is sent in step 207, the service capability middlewarethat stores the subject resource further sends a retrieve request toOutput URI to retrieve a representation of the resource indicated byOutput URI, and saves the retrieved representation of the resourceindicated by Output URI into the execution result attribute in therepresentation of the operation resource.

If Output URI is not provided in the representation of the operationresource, it indicates that the execution result corresponding to theoperation request does not need to be reflected by a representation ofanother resource. In this case, after step 207 is executed, theoperation response corresponding to the operation request in step 207 isreceived. Content of the operation response is saved into the executionresult in the representation of the operation resource. For a specificimplementation process of step 208, reference may be made to anembodiment shown in FIG. 15 .

Step 209: Determine whether the selected resource is a last operationresource. If the selected resource is the last operation resource, thatis, if it is determined that operations of the multiple operationresources selected in step 203 have been executed, go to step 210;otherwise, return to step 204. In this step, determining whether anoperation of an operation resource is executed may be determiningwhether a corresponding operation response is received.

Step 210: End.

FIG. 4 is a schematic flowchart of configuring operation triggeringaccording to an embodiment of the present invention. In this embodiment,an operation resource is configured for a temperature value of atemperature sensor, so that turning on an air conditioner is triggeredwhen a temperature is higher than 30° C. and a family member is at home.A system architecture diagram thereof may be shown in FIG. 7 .

An M2M network application (NA) server registers various M2Mapplications (such as electricity meter reading and intelligent traffic)with a network service capability layer (NSCL) of an M2M serviceplatform by using a mIa interface. The M2M service platform accesses anM2M device using a mId interface to collect data, and further performsremote device management on the M2M device by using the interface. AnM2M device d is connected to the NSCL of the M2M service platform usingan M2M gateway. An M2M device D is connected to the NSCL of the M2Mservice platform using the mId interface.

An M2M device D′ is a conventional device that does not comply with anETSI M2Mstandard. The M2M device D is a device that complies with theETSI M2M standard. The M2M device D has a service capability layer (SCL)that is defined by the ETSI M2M standard. The M2M device D′ does nothave the SCL defined by the ETSI M2M standard.

By using a gateway interworking proxy function (GIP), the M2M gatewayinterworks with the conventional M2M device d and M2M device D′ in awireless or wired communications manner (for example, ZigBee, Bluetooth,DLMS/COSEM, Zwave, BACnet, ANSI C12, and mBus). The mId interfacebetween the M2M gateway or M2M device D and the M2M platform generallyuses wired or wireless wide area local area network communicationmanners (for example, xDSL, HFC, satellite, GERAN, U IRAN, E-U IRAN,WLAN, and WiMAX).

A D′A1 is a temperature sensor application. The D′A1 continuously savestemperature values to a temperate resource in a resource tree of agateway service capability layer GSCL1. A URI of the subject resourceTemperature resource is http://gscll/temperature. An NA1 is a smart homeapplication program. The NA1 is used to create a representation of anoperation resource associated with the temperature resource. A D′A5 isan air conditioner application program. The D′A5 controls an airconditioner by monitoring a representation value of an air condition(AirCondition) resource in a GSCL2. For example, the D′A5 turns on theair conditioner when the representation value of the air conditionresource is ON, and turns off the air conditioner when therepresentation value of the air condition resource is OFF. A URI of theair condition resource is http://gscl2/airCondition.

An NA2 is a host location application program. The application programsaves location information of a host to a host location (HostLocation)resource in the NSCL. A URI of the host location resource ishttp://nscl/hostLocation.

When a representation value of the temperature resource is higher than30 degrees Celsius, the GSCL1 needs to send a request to the GSCL2 tochange the representation of the air condition resource to ON, therebyachieving an objective of turning on the air conditioner. The NA1completes this process by creating the representation of the operationresource associated with the temperature resource.

As shown in FIG. 4 , the following steps are included.

Step 301: Create a representation of an operation resource.

The NA1 on the network application server constructs an operationresource for turning on an air conditioner (TurnOnAC), which is used toexpress a condition for triggering the operation of turning on an airconditioner. According to a requirement of service logic, this step maybe repeated multiple times to create representations of multipleoperation resources. An architecture of the operation resource TurnOnACis shown in FIG. 5 .

Step 302: Send an operation resource create request.

After step 301, the NA1 on the network application server encapsulatesthe constructed representation of the operation resource TurnOnACaccording to a standard of a RESTful architecture on an interface, andsends it to the gateway service capability layer GSCL1. The GSCL1creates the operation resource TurnOnAC in an operation resource setassociated with the temperature resource, where a URI of the operationresource set is http://gscl1/temperature/Operations. That is, theoperation resource create request carries the URI of the operationresource set and the constructed representation of the operationresource. If the operation resource set associated with the subjectresource, for example, the temperature resource, does not exist, theoperation resource create request may carry the URI of the temperatureresource or a URI of the GSCL1, and the GSCL1 creates the operationresource. For example, the GSCL1 creates the operation resource in therepresentation of the temperature resource, or creates the operationresource elsewhere, and includes a URI of the operation resource intothe representation of the temperature resource. The embodiment of thepresent invention is described using an example in which the operationresource create request carries the URI of the operation resource set.

Step 303: Create the operation resource.

After receiving the operation resource create request sent by the NA1,the gateway service capability layer GSCL1 creates, in the operationresource set (Operations) associated with the temperature resource, theoperation resource TurnOnAC in the operation resource create request,that is, adds the representation of the operation resource TurnOnAC tothe operation resource set, so that the operation resource TurnOnAC andthe temperature resource are associated. After completing creating theoperation resource TurnOnAC, the gateway service capability layerreturns a create response to the NA1.

Step 304: Create a representation of a dependency resource.

According to service requirements, the NA1 begins to create dependencyresources associated with different operation resources. In thisembodiment, whether to turn on the air conditioner depends on a locationof the host, that is, a status of the host location resourceHostLocation, and the host location resource HostLocation is thedependency resource associated with the operation resource TurnOnAC.Therefore, a dependency resource MemberAtHome is created, and arepresentation of the dependency resource MemberAtHome may indicatewhether a member is at home. As shown in FIG. 6 , in the dependencyresource MemberAtHome, a value of Logic is OR, indicating that a type ofthe dependency resource is a sufficient condition type; a URI is the URIof the host location resource; a condition Rule is that the status of ahost location is at home.

Step 305: Send a dependency resource create request.

After step 304, the NA1 encapsulates the constructed representation ofthe dependency resource MemberAtHome according to a standard of theRESTful architecture on an interface, and sends it to the gatewayservice capability layer GSCL1. The GSCL1 creates the dependencyresource MemberAtHome in a dependency resource set associated with theoperation resource TurnOnAC, where a URI of the dependency resource setis http://gscl1/temperature/Operations/TurnOnAC/Dependencies. That is,the dependency resource create request includes the URI of thedependency resource set. In addition, referring to step 302, thedependency resource create request may further include the URI of theoperation resource to indicate that no dependency resource or dependencyresource set exists in the operation resource, so that the GSCL1directly saves the representation of the dependency resource into theoperation resource TurnOnAC. This embodiment is described using anexample in which the dependency resource create request carries the URIof the dependency resource set. In addition, the dependency resourcecreate request may be sent as defined in the standard.

Step 306: Create the dependency resource.

After receiving the dependency resource create request sent by the NA1,the GSCL1 adds the representation of the dependency resourceMemberAtHome in the dependency resource create request to the dependencyresource set associated with the operation resource TurnOnAC. That is,the GSCL1 associates the dependency resource MemberAtHome with thedependency resource set, and thereby also associates the dependencyresource MemberAtHome with the operation resource TurnOnAC. After thedependency resource is created, a create response is returned.

On a basis of the embodiment shown in FIG. 4 , when the temperature ishigher than 30 degrees Celsius, windows further need to be closed inaddition to turning on the air conditioner, that is, two operations aretriggered. The NA1 may define that a priority of closing the windows ishigher than a priority of turning on the air conditioner, that is, thewindows need to be closed before the air conditioner is turned on. Thesystem architecture in FIG. 7 further includes a controller applicationprogram D′A4 for closing windows. The D′A4 controls the windows bymonitoring a value of a Window resource in the gateway servicecapability layer GSCL2. For example, when a representation of the Windowresource is ON, the windows are opened, and when the representation ofthe Window resource is OFF, the windows are closed. A URI of the Windowresource is http://gscl2/window.

An architecture diagram of an operation resource CloseWindow for closingwindows may be shown in FIG. 8 . A value of an input parameter Input ofthe operation resource CloseWindow is a URI, while an input parameter isdirectly saved in Input of the TurnOnAC. Output URI of the operationresource CloseWindow is http://gscl2/allWindowStatus, that is, a URI ofan allWindowStatus resource. A representation of the allWindowStatusresource indicates a closing status of windows in a house. ON indicatesthat a window is opened. OFF indicates that all the windows are closed.

The operation resource CloseWindow and the operation resource TurnOnACare separately associated with the subject resource Temperature. Aschematic diagram of a specific association may be shown in FIG. 9 .

When the representation of the temperature resource is higher than 30degrees, the two operations of the operation resource TurnOnAC andoperation resource CloseWindow are triggered. In this embodiment, thetemperature resource Temperature is saved in the gateway servicecapability layer GSCL1, and both the operation resource TurnOnAC andoperation resource CloseWindow are saved in the gateway servicecapability layer GSCL2. A specific process thereof includes steps shownin FIG. 10 .

Step 401: The GSCL1 retrieves a change result of content of thetemperature resource.

In an embodiment, the temperature resource Temperature is used as asubject resource, and the content of the temperature resource ischanged. The change result of the content retrieved by the GSCL1 is 31degrees.

Step 402: The GSCL1 determines operation resources associated with thetemperature resource Temperature.

Specifically, an association manner in this embodiment may be that therepresentation of the temperature resource includes a URI of anoperation resource set to which the operation resource TurnOnAC andoperation resource CloseWindow belong. In this embodiment, anarchitecture diagram of the temperature resource may be shown in FIG. 9. In this step, the determined operation resources associated with thetemperature resource are TurnOnAC and CloseWindow.

Step 403: Determine that the change result of the content of thetemperature resource meets conditions defined by rules inrepresentations of the operation resources TurnOnAC and CloseWindowdetermined in step 402. Rule defines a method for matchingrepresentations of resources. In ETSI M2M, Rule is a filterCriteriaattribute defined by the ETSI M2M standard. In this embodiment, theconditions defined by the rules in the representations of the TurnOnACand CloseWindow are >30° C., and the representation of the temperatureresource is changed to 31° C. Therefore, the conditions defined by therules in the TurnOnAC and CloseWindow are both met, and the twooperation resources are selected in this step. In subsequent steps,corresponding operations are executed on the selected operationresources one by one.

Step 404: Both the representations of the two operation resourcesinclude priorities of the operation resources. In this embodiment, thepriority of the operation resource CloseWindow is 2, and the priority ofthe operation resource TurnOnAC is 1. Therefore, the priority of theoperation resource CloseWindow is higher than the priority of theoperation resource TurnOnAC. Therefore, in this step, choose to executethe operation corresponding to the operation resource CloseWindow of thehigher priority first.

Step 405: Determine that a condition defined by Rule in a dependencyresource associated with the operation resource CloseWindow is met. Fordetailed steps, reference may be made to an embodiment shown in FIG. 14.

Step 406: Retrieve an input parameter required for creating an operationrequest for the operation resource CloseWindow. For detailed steps,reference may be made to an embodiment shown in FIG. 11 .

Step 407: According to a request type (Method) and an object resourceincluded in the representation of the operation resource CloseWindow andthe input parameter retrieved in step 406, construct the operationrequest to be sent. In this embodiment, the type of the operationrequest is create, a URI of the object resource is http://gscl3/window,and the retrieved input parameter (Input) is OFF. In the ETSI M2Mstandard, an operation request transmitted on a standard RESTfulinterface may be constructed according to the foregoing attributes.

Step 408: Send the operation request constructed in step 407 to a GSCL3.The operation request may be sent using a standard RESTful interfacedefined in an M2M system. Step 408 may also include receiving anoperation response that is returned by the GSCL3 after the operation inthe operation request, for example, closing a window, is completed by awindow controller.

Step 409: Retrieve an execution result corresponding to the operationrequest. For detailed steps, reference may be made to an embodimentshown in FIG. 15 .

Step 410: With respect to the priorities of the operation resourcesselected in step 403, select a remaining operation resource of a highestpriority, and continue to execute the following steps. In thisembodiment, the operation resource TurnOnAC is selected in this step.

Step 411: Determine that a condition defined by Rule in a representationof a dependency resource associated with the operation resource TurnOnACis met. For detailed steps, reference may be made to the embodimentshown in FIG. 14 .

Step 412: Retrieve an input parameter required for creating an operationrequest for the TurnOnAC. For detailed steps, reference may be made tothe embodiment shown in FIG. 11 .

Step 413: According to a type (Method) and an object resource includedin the operation resource TurnOnAC and the input parameter retrieved instep 412, construct the operation request to be sent. In thisembodiment, the type of the operation request is create, a URI of theobject resource is http://gscl2/airCondition, and the retrieved inputparameter (Input) is ON. With reference to the ETSI M2M standard, anoperation request transmitted on a standard RESTful interface may beconstructed according to the foregoing attributes.

Step 414: Send the operation request created in step 413 to the GSCL2,and receive an operation response. The operation request may be sentusing a standard RESTful interface defined in the M2M system.

Step 415: Retrieve an operation execution result. For detailed steps,reference may be made to the embodiment shown in FIG. 15 .

In the embodiment shown in FIG. 10 , the GSCL2, GSCL1, and GSCL3 may bea same GSCL, or may be different GSCLs, which is not limited herein inthe embodiment of the present invention.

Input included in a representation of an operation resource indicates aninput parameter required for constructing an operation request.Operation requests of the types of operation requests specified by theRESTful architecture, delete and retrieve, do not require an inputparameter, but operation requests of create and update need to carryrepresentations of object resources for creating an object resource andupdating an object resource, respectively. In step 406 and step 412 inthe foregoing embodiment shown in FIG. 10 , the input parameters areretrieved when the operation requests for the operation resourcesCloseWindow and TurnOnAC are constructed separately. A specific processthereof is shown in FIG. 11 , where a URI saved in the input parameteris http://gscl3/OFF, and service capability middleware in which aresource pointed to by the URI is located is the GSCL3. As shown in FIG.11 , a process for determining whether an input parameter needs to beretrieved may include the following steps.

Step 501: Start the process. Determine an operation corresponding to anoperation resource that needs to be executed. For example, the operationcorresponding to the operation resource CloseWindow or the operationcorresponding to the operation resource TurnOnAC, may need to beexecuted.

Step 502: Determine an operation request type (Method) in arepresentation of the operation resource that is being executed. In thisembodiment, both the request types (Method) in the representations ofthe operation resources CloseWindow and TurnOnAC are create, and step503 is executed. In addition, if the request type is delete or retrieve,an input parameter does not need to be considered when an operationrequest is constructed, and step 506 may be executed directly.

Step 503: Determine whether a URI of a parameter resource is saved in aninput parameter Input in the representation of the operation resourcethat is being executed.

The URI is in a fixed format, and made up of parts such as a schema, ahost, a port, and a path. For details, reference may be made to IETF RFC3305. The URI saved in the input parameter Input indicates that theinput parameter required for constructing the operation request is arepresentation of the parameter resource pointed to by the URI. Forexample, for the operation resource CloseWindow in this embodiment, theURI http://gscl2/OFF is saved in the input parameter Input in therepresentation of the operation resource. If the URI is saved in theinput parameter, the process proceeds to step 505. If no URI is saved inthe input parameter, but a representation of a resource is directlysaved as a representation of a new object resource, the process proceedsto step 504.

Step 504: Construct an operation request of the create type, anddirectly use a representation of an object resource saved in the inputparameter, as content of the operation request. For example,<textContent>ON<textContent> is saved in the input parameter in therepresentation of the operation resource TurnOnAC, and the text segmentis the input parameter that is required for creating the operationrequest for the operation resource TurnOnAC.

Step 505: When the input parameter in the representation of theoperation resource that is being executed is the URI, a retrieve requestneeds to be sent to the URI to retrieve a representation of a resourcepointed to by the URI as the representation of the new object resource.For example, the URI saved in the input parameter Input in therepresentation of the operation resource CloseWindow ishttp://gscl3/OFF, which indicates that the GSCL1 (the service capabilitymiddleware in which the Temperature is located) needs to send a retrieverequest (Retrieve) to the GSCL3 (the service capability middleware inwhich http://gscl3/OFF is located) to retrieve a representation of aresource indicated by http://gscl3/OFF as the representation of the newobject resource.

Step 506: The input parameter is not required for constructing anoperation request of the delete or retrieve type, and the processdirectly proceeds to step 507.

Step 507: Execute the steps next to step 406 and step 412 in theembodiment shown in FIG. 10 .

In step 405 and step 411 in the embodiment shown in FIG. 10 , before theoperations are executed, it is necessary to determine whether theconditions defined by the rules in the representations of the dependencyresources of the operation resources are met. In this embodiment, it isto determine whether a condition defined by Rule in a representation ofeach dependency resource of the operation resources TurnOnAC andCloseWindow can be met. In the system architecture shown in FIG. 7 , aD′A2 is a bedroom window sensor application program used to detectwhether a window in a bedroom is closed, and this application programuses a representation of a BedroomWindowStatus resource in the GSCL1 toindicate a current status of the window in the bedroom. A URI of theBedroomWindowStatus resource is http://gscl1/bedroomWindowStatus. A D′A3is a living room window sensor application program used to detectwhether a window in a living room is closed, and this applicationprogram uses a representation of a LivingroomWindowStatus resource inthe GSCL1 to indicate a current status of the window in the living room.A URI of the LivingroomWindowStatus resource ishttp://gscl1/livingroomWindowStatus. In the current embodiment, when therepresentation of the temperature resource is higher than 30° C., thewindows needs to be closed before the air conditioner is turned on.Before the operation of closing the windows is executed, it is necessaryto determine whether the windows in the living room and bedroom havebeen closed. That is, execution of the operation of the operationresource CloseWindow further depends on the representations of the twodependency resources BedroomWindowStatus and LivingroomWindowStatus. Ifone window is not closed, the operation of closing a window needs to beexecuted.

Meanwhile, the operation of turning on the air conditioner is executedonly after it is ensured that all the windows are closed and it isdetermined that the host is at home. In summary, the architecture of thedependency resource sets of the updated operation resource TurnOnAC forturning on the air conditioner and the updated operation resourceCloseWindow for closing the windows may be shown in FIG. 12 and FIG. 13.

For each operation resource, determining whether a condition defined byRule in a representation of a dependency resource associated with theoperation resource may include the steps shown in FIG. 14 .

Step 601: Start.

Step 602: The GSCL1 determines all the dependency resources associatedwith the operation resources, where the dependency resources associatedwith the operation resource TurnOnAC include MemberAtHome,LivingroomWindowClosed, and BedroomWindowClosed, and the dependencyresources associated with the operation resource CloseWindow includeLivingroomWindowOpen and BedroomWindowOpen.

Step 603: Select one dependency resource associated with each operationresource in sequence, and execute step 604 to step 610, discussed below,for each dependency resource.

Step 604: According to a URI in the representation of the dependencyresource, retrieve a representation of a condition resource pointed toby the URI; for example, according to http://nscl/hospLocation, andretrieve a representation of a condition resource pointed to by the URI,that is, retrieve the location of the host.

Step 605: Determine whether the representation of the condition resourcemeets the condition defined by Rule in the dependency resource. If thecondition is met, execute step 606; otherwise, execute step 607.

In this embodiment, assuming that the location of the host is at home,the representation of the condition resource meets the condition definedby Rule in the dependency resource.

Step 606: Determine whether a type of the dependency resource is thesufficient condition type or the necessary condition type. If it is thesufficient condition type, execute step 609; if it is the necessarycondition type, execute step 608.

In this embodiment, the type of the dependency resource MemberAtHome isAND, that is, the necessary condition type, and therefore, it is furthernecessary to determine whether a condition in another dependencyresource is met.

Step 607: Determine whether a type of the dependency resource is thesufficient condition type or the necessary condition type. If it is thenecessary condition type, execute step 610; if it is the sufficientcondition type, execute step 608.

Step 608: Determine whether the dependency resource is a last dependencyresource. If the dependency resource is not the last dependencyresource, execute step 603. If the dependency resource is the lastdependency resource, there are two cases. If it is determined in step605 that the representation of the condition resource meets thecondition defined by Rule in the dependency resource, execute step 609.If it is determined in step 605 that the representation of the conditionresource does not meet the condition defined by Rule in the dependencyresource, execute step 610.

Step 609: Proceed to execute a next step, that is, step 406 and step 412in the embodiment shown in FIG. 10 .

Step 610: Terminate the operation for the operation resource.

Specifically, for the operation resource CloseWindow, the dependencyresource first selected in step 603 is the LivingroomWindowOpen. Arepresentation of a resource indicating whether the window in the livingroom is opened, namely, a closed state (Closed), is further retrievedaccording to the URI http://gscl1/livingroomWindowStatus of thedependency resource LivingroomWindowOpen in step 604. In step 605, it isdetermined whether the representation of the resource retrieved in step604 that indicates whether the window in the living room is opened meetsthe condition defined by Rule in the representation of the dependencyresource LivingroomWindowOpen. The condition defined by Rule in therepresentation of the dependency resource LivingroomWindowOpen is anopen state (Open), and therefore, a determining result is that thecondition is not met, and step 607 is executed. In step 607, it isdetermined that the type of the dependency resource defined by logic inthe representation of the dependency resource LivingroomWindowOpen isthe sufficient condition type (OR), and therefore, step 608 is furtherexecuted. In step 608, it is determined that, for the operation resourceCloseWindow, there is another dependency resource on which determininghas not been performed, and therefore, the process returns to step 603.In step 603, the next dependency resource BedroomWindowOpen is selected,and a representation of a resource indicating whether the window in thebedroom is opened, namely, an open state (Open), is retrieved accordingto the URI http://gscl1/bedroomWindowStatus of the dependency resourceBedroomWindowOpen in step 604. In step 605, it is determined whether therepresentation of the resource retrieved in step 604 that indicateswhether the window in the bedroom is opened meets the condition definedby Rule in the representation of the dependency resourceBedroomWindowOpen. The condition defined by Rule in the representationof the dependency resource BedroomWindowOpen is an open state (Open),and therefore, a determining result is that the condition is met, andstep 606 is executed. In step 606, it is determined that the type of thedependency resource defined by logic in the representation of thedependency resource BedroomWindowOpen is the sufficient condition type,and step 609 is executed.

For the operation resource TurnOnAC, the dependency resourceLivingroomWindowClosed is selected first in step 603. The representationof the resource indicating whether the window in the living room isopened, namely, the closed state (Closed), is retrieved according to theURI http://gscl1/livingroomWindowStatus of the dependency resourceLivingroomWindowClosed in step 604. In step 605, it is determinedwhether the representation of the resource retrieved in step 604 thatindicates whether the window in the living room is opened meets thecondition defined by Rule in the representation of theLivingroomWindowOpen. The condition defined by Rule in therepresentation of the dependency resource LivingroomWindowOpen is theclosed state (Closed), and therefore, a determining result is that thecondition is met, and step 606 is executed. In step 606, it isdetermined that the type of the dependency resource defined by the logicin the representation of the dependency resource LivingroomWindowOpen isthe necessary condition type (AND), and therefore, step 608 is furtherexecuted. In step 608, it is determined whether there is anotherdependency resource that is associated with the operation resourceTurnOnAC and on which determining has not been performed. Because thedependency resource BedroomWindowClosed exists, step 603 is executed,and the dependency resource BedroomWindowClosed is selected. Therepresentation of the resource indicating whether the window in thebedroom is opened, namely, the closed state (Closed), is retrievedaccording to the URI http://gscl1/bedroomWindowStatus of the dependencyresource BedroomWindowClosed in step 604. In step 605, it is determinedwhether the representation of the resource retrieved in step 604 thatindicates whether the window in the bedroom is opened meets thecondition defined by Rule in the representation of the dependencyresource BedroomWindowOpen. The condition defined by Rule in therepresentation of the dependency resource BedroomWindowOpen is theclosed state (Closed), and therefore, a determining result is that thecondition is not met, and step 607 is executed. In step 607, it isfurther determined that the logic in the representation of thedependency resource MemberAtHome defines that the type of the dependencyresource is the necessary condition type, and step 610 is executeddirectly.

The following is an embodiment of how to retrieve execution results ofoperation requests after operations are triggered by a change of asubject resource. For details, reference may be made to step 409 andstep 415 in the embodiment shown in FIG. 10 , where operation executionresults need to be retrieved after operation requests for the operationresource CloseWindow and operation resource TurnOnAC are sentseparately. As shown in the resource structural diagram of the operationresource TurnOnAC shown in FIG. 5 and the resource structural diagram ofthe operation resource CloseWindow shown in FIG. 8 , Output URI of theoperation resource TurnOnAC is N/A, while Output URI of the operationresource CloseWindow is http://gscl2/allWindowStatus. A specific processof retrieving the operation execution results may include the stepsshown in FIG. 15 .

Step 701: Referring to step 409 and step 415 in the embodiment shown inFIG. 10 , start after the operation requests for the operation resourceCloseWindow and operation resource TurnOnAC are sent and operationresponses are received.

Step 702: The GSCL1 determines whether the addresses (Output URI)reflecting the operation execution results in the representations of theoperation resources are N/A. In this embodiment, Output URI in therepresentation of the operation resource TurnOnAC is N/A, and step 703is executed, while Output URI in the representation of the operationresource CloseWindow is not N/A, and step 704 is executed.

Step 703: As shown in step 415 in the embodiment shown in FIG. 10 , theprocess of retrieving the operation execution results occurs after theoperation requests are sent and the operation responses are received. Ina case in which Output URI in the representation of the operationresource is N/A, the operation response is directly saved into theexecution result “Result”. For the operation resource TurnOnAC, theoperation response corresponding to the operation request of the createtype is OK, and therefore, OK is saved into Result in the representationof the operation resource TurnOnAC.

Step 704: In a case in which Output URI of the operation resource is notN/A, the address reflecting the operation execution result is saved intoOutput URI. That is, a URI of a resource that stores the operationexecution result is saved into Output URI. Therefore, a retrieve requestis sent to the URI of the resource that stores the operation executionresult, so that the representation of the resource is retrieved. For theoperation resource CloseWindow, a retrieve request is sent to the URIhttp://gscl2/allWindowStatus of the resource that stores the operationexecution result, and a retrieve response is received. The retrieveresponse includes the representation of the allWindowStatus resource,that is, all windows are closed.

Step 705: Save the representation of the allWindowStatus resourceretrieved in step 704 into the execution result “Result” in therepresentation of the operation resource CloseWindow.

Step 706: End.

An embodiment of the present invention further provides an apparatuscorresponding to the foregoing method. FIG. 16 is schematic structuraldiagram 1 of an operation triggering apparatus for machine-to-machinecommunications according to an embodiment of the present invention. Theapparatus stores a representation of a subject resource, where therepresentation of the subject resource includes content of the subjectresource and information about an operation resource associated with thesubject resource, as shown in FIG. 16 .

The apparatus includes a retrieving module 11, a constructing module 12,and a sending module 13. The retrieving module 11 is configured toretrieve a change result of the stored content of the subject resourcewhen the content of the subject resource is changed, and retrieve,according to the information about the operation resource associatedwith the subject resource, a representation of the operation resourceassociated with the subject resource. The representation of theoperation resource includes a condition for sending an operation requestto an object resource and a uniform resource identifier of the objectresource. The retrieving module is further configured to send the changeresult and the representation of the operation resource to theconstructing module. The constructing module 12 is configured to receivethe change result and the representation of the operation resourceassociated with the subject resource, and when it is determined that thechange result meets the condition for sending the operation request tothe object resource in the representation of the operation resource,construct the operation request for the object resource, and send theoperation request to the sending module. The sending module 13 isconfigured to receive the operation request, and send the operationrequest to the object resource according to the uniform resourceidentifier of the object resource.

In the technical solution provided by the foregoing embodiment of thepresent invention, when the content of the subject resource is changed,the apparatus that stores the change result of the content of thesubject resource retrieves, according to the information about theoperation resource associated with the subject resource, therepresentation of the operation resource associated with the subjectresource, and constructs the operation request for the object resourcein the representation of the operation resource, and sends the operationrequest to the object resource in the representation of the operationresource. The operation triggering apparatus for machine-to-machinecommunications in the foregoing embodiment of the present invention maybe middleware on an M2M platform or gateway. Both the M2M platform andthe gateway are nodes having capabilities in a network, and therefore aproblem of capability restriction does not exist, which is advantageousfor handling situations in which services cannot be performed inrestricted environments.

Further, the information about the operation resource associated withthe subject resource is the representation of the operation resourceassociated with the subject resource, and the retrieving moduleretrieving, according to the information about the operation resourceassociated with the subject resource, a representation of the operationresource associated with the subject resource, includes: retrieving,according to the representation of the operation resource associatedwith the subject resource included in the representation of the subjectresource, the representation of the operation resource associated withthe subject resource. In an embodiment, the information about theoperation resource associated with the subject resource is a uniformresource identifier of the operation resource associated with thesubject resource, and the retrieving module retrieving, according to theinformation about the operation resource associated with the subjectresource, a representation of the operation resource associated with thesubject resource, includes: retrieving, according to the uniformresource identifier of the operation resource included in therepresentation of the subject resource, the representation of theoperation resource associated with the subject resource. In anembodiment, the information about the operation resource associated withthe subject resource is a uniform resource identifier of an operationresource set to which the operation resource associated with the subjectresource belongs, and the retrieving module retrieving, according to theinformation about the operation resource associated with the subjectresource, a representation of the operation resource associated with thesubject resource, includes: retrieving, according to the uniformresource identifier of the operation resource set to which the operationresource belongs that is included in the representation of the subjectresource, the representation of the operation resource associated withthe subject resource, where the representation of the operation resourceassociated with the subject resource is a representation of an operationresource included in the operation resource set.

The operation triggering apparatus for machine-to-machine communicationsaccording to the foregoing embodiment of the present invention mayfurther include a receiving module. The receiving module is configuredto receive a subject resource update request before the retrievingmodule retrieves the change result of the content of the subjectresource stored in the apparatus. The subject resource update requestincludes a representation of a new subject resource and a uniformresource identifier of the subject resource to be updated, where therepresentation of the new subject resource includes information about anoperation resource associated with the new subject resource. Thereceiving module updates the stored representation of the subjectresource to the representation of the new subject resource according tothe uniform resource identifier of the subject resource to be updated.In an embodiment, the receiving module is configured to receive anoperation resource create request before the retrieving module retrievesthe change result of the content of the subject resource stored in theapparatus. The operation resource create request includes therepresentation of the operation resource associated with the subjectresource and the uniform resource identifier of the operation resourceset to which the operation resource belongs, and the receiving moduleadds the representation of the operation resource to the operationresource set according to the uniform resource identifier of theoperation resource set to which the operation resource belongs.

In addition, in the foregoing embodiment of the present invention, therepresentation of the operation resource further includes a type of theoperation request and an input parameter of the operation request, wherethe type of the operation request is create or update. When the inputparameter is a uniform resource identifier of a parameter resource, theconstructing module constructing the operation request for the objectresource includes the constructing module: retrieving a representationof a new object resource from the parameter resource that is pointed toby the uniform resource identifier of the parameter resource, andconstructing the operation request that includes the uniform resourceidentifier of the object resource and the representation of the newobject resource and that is for the object resource in therepresentation of the operation resource. In an embodiment, when theinput parameter is a representation of a new object resource, theconstructing module constructing the operation request for the objectresource includes the constructing module: constructing the operationrequest that includes the uniform resource identifier of the objectresource and the representation of the new object resource and that isfor the object resource in the representation of the operation resource.

In addition, the receiving module in the foregoing operation triggeringapparatus for machine-to-machine communications is further configured toreceive an operation resource update request before the retrievingmodule retrieves the change result of the content of the subjectresource stored in the service capability middleware. The operationresource update request includes a representation of a new operationresource, where the representation of the new operation resourceincludes a representation of a dependency resource or a uniform resourceidentifier of a dependency resource. The receiving module is configuredto update the stored representation of the operation resource to therepresentation of the new operation resource. The receiving module isfurther configured to receive a dependency resource create requestbefore the retrieving module retrieves the change result of the contentof the subject resource stored in the service capability middleware. Thedependency resource create request includes a representation of adependency resource and a uniform resource identifier of a dependencyresource set to which the dependency resource belongs. The receivingmodule is also configured to save the representation of the dependencyresource to the dependency resource set according to the uniformresource identifier of the dependency resource set to which thedependency resource belongs, and add the uniform resource identifier ofthe dependency resource set to the representation of the operationresource.

Further, in the technical solution in which the dependency resourceexists, the foregoing apparatus may further include a determiningmodule. The retrieving module is further configured to retrieve,according to the representation of the operation resource, therepresentation of the dependency resource associated with the operationresource, retrieve a representation of a condition resource that ispointed to by a uniform resource identifier in the representation of thedependency resource, and send the representation of the conditionresource and a condition in the representation of the dependencyresource to the determining module. The determining module is configuredto receive the representation of the condition resource, and determine,according to the representation of the condition resource, that thecondition in the representation of the dependency resource is met.

In an embodiment, types of the dependency resource are classified into asufficient condition type and a necessary condition type, and adependency resource quantity is at least one. Before the constructingmodule constructs the operation request for the object resource in therepresentation of the operation resource, the determining module isfurther configured to determine that a condition specified by at leastone dependency resource of the sufficient condition type is met, orbefore the constructing module constructs the operation request for theobject resource in the representation of the operation resource, thedetermining module is further configured to determine that conditionsspecified by all dependency resources of the necessary condition typeare met.

The association relationship between the operation resource and thedependency resource may be implemented in three manners. The retrievingmodule retrieving, according to the representation of the operationresource, the representation of the dependency resource associated withthe operation resource, includes: retrieving, according to therepresentation of the dependency resource included in the representationof the operation resource, the representation of the dependency resourceassociated with the operation resource; or retrieving, according to theuniform resource identifier of the dependency resource included in therepresentation of the operation resource, the representation of thedependency resource associated with the operation resource; orretrieving, according to the uniform resource identifier, included inthe representation of the operation resource, of the dependency resourceset to which the dependency resource belongs, the representation of thedependency resource associated with the operation resource, where therepresentation of the dependency resource associated with the operationresource is a representation of a dependency resource included in thedependency resource set.

In the foregoing embodiment of the present invention, at least twooperation resources are associated with the subject resource, andrepresentations of the operation resources further include priorities.The constructing module constructing the operation request for theobject resource in the representation of the operation resourceincludes: constructing an operation request for an object resource inthe representation of each operation resource in sequence according tothe priorities in the representations of the operation resources.

In the foregoing embodiment of the present invention, the representationof the operation resource further includes an operation executionresult. The receiving module is further configured to receive anoperation response returned by a device that the object resource islocated, and save the operation response into the operation executionresult in the representation of the operation resource. In anembodiment, the representation of the operation resource furtherincludes an address reflecting an operation execution result and theoperation execution result. The receiving module is further configuredto receive an operation response returned by the device in which theobject resource is located, and the retrieving module is furtherconfigured to retrieve, according to the address reflecting theoperation execution result, an operation result corresponding to theoperation request, and save the operation result corresponding to theoperation request into the operation execution result.

In addition, an embodiment of the present invention further providesanother operation triggering apparatus for machine-to-machinecommunications. FIG. 17 is schematic structural diagram 2 of anoperation triggering apparatus for machine-to-machine communicationsaccording to an embodiment of the present invention. As shown in FIG. 17, the operation triggering apparatus for machine-to-machinecommunications includes a network interface 21, a processor 22, and amemory 23.

The network interface 21 is configured to perform communication with anexternal device. The memory 23 is configured to store an applicationprogram and store a representation of a subject resource. Therepresentation of the subject resource includes content of the subjectresource and information about an operation resource associated with thesubject resource. The processor 22 is configured to: invoke theapplication program stored in the memory. When the content of thesubject resource is changed, the processor 22 is configured to retrievea change result of the content of the subject resource stored in thememory, and retrieve, according to the information about the operationresource associated with the subject resource, a representation of theoperation resource associated with the subject resource. Therepresentation of the operation resource includes a condition forsending an operation request to an object resource and a uniformresource identifier of the object resource. When it is determined thatthe change result meets the condition for sending the operation requestto the object resource in the representation of the operation resource,the processor 22 is configured to construct the operation request forthe object resource. The network interface 21 is further configured tosend the operation request to the object resource according to theuniform resource identifier of the object resource.

In the technical solution provided by the foregoing embodiment of thepresent invention, the network interface 21, processor 22, and memory 23may be connected by a system bus 24. When the content of the subjectresource is changed, the service capability middleware that stores thechange result of the content of the subject resource retrieves,according to the information about the operation resource associatedwith the subject resource, the representation of the operation resourceassociated with the subject resource, and constructs the operationrequest for the object resource in the representation of the operationresource, and sends the operation request to the object resource in therepresentation of the operation resource. The computer device in theforegoing embodiment of the present invention may be an M2M platform orgateway. Both the M2M platform and the gateway are nodes havingcapabilities in a network, and therefore a problem of capabilityrestriction does not exist, which is advantageous for handlingsituations in which services cannot be performed in restrictedenvironments.

In the foregoing embodiment of the present invention, the informationabout the operation resource associated with the subject resource is therepresentation of the operation resource associated with the subjectresource. The processor retrieving, according to the representation ofthe subject resource, a representation of the operation resourceassociated with the subject resource, includes the processor:retrieving, according to the representation of the operation resourceincluded in the representation of the subject resource, therepresentation of the operation resource associated with the subjectresource. In an embodiment, the information about the operation resourceassociated with the subject resource is a uniform resource identifier ofthe operation resource associated with the subject resource. Theprocessor retrieving, according to the representation of the subjectresource, a representation of the operation resource associated with thesubject resource, includes the processor: retrieving, according to theuniform resource identifier of the operation resource included in therepresentation of the subject resource, the representation of theoperation resource associated with the subject resource. In anembodiment, the information about the operation resource associated withthe subject resource is a uniform resource identifier of an operationresource set to which the operation resource associated with the subjectresource belongs. The processor retrieving, according to therepresentation of the subject resource, a representation of theoperation resource associated with the subject resource, includes theprocessor: retrieving, according to the uniform resource identifier ofthe operation resource set to which the operation resource belongsincluded in the representation of the subject resource, therepresentation of the operation resource associated with the subjectresource, where the representation of the operation resource associatedwith the subject resource is a representation of an operation resourceincluded in the operation resource set.

In addition, the network interface is further configured to receive asubject resource update request, where the subject resource updaterequest includes a representation of a new subject resource and auniform resource identifier of the subject resource to be updated. Therepresentation of the new subject resource includes information about anoperation resource associated with the new subject resource. Theprocessor invokes the application program stored in the memory to updatethe stored representation of the subject resource to the representationof the new subject resource according to the uniform resource identifierof the subject resource to be updated. In an embodiment, the networkinterface is further configured to receive an operation resource createrequest. The operation resource create request includes therepresentation of the operation resource associated with the subjectresource and the uniform resource identifier of the operation resourceset to which the operation resource associated with the subject resourcebelongs. The processor invokes the application program stored in thememory to add the representation of the operation resource to theoperation resource set according to the uniform resource identifier ofthe operation resource set to which the operation resource belongs.

In the foregoing embodiment of the present invention, the representationof the operation resource further includes a type of the operationrequest and an input parameter of the operation request, where the typeof the operation request is create or update; and when the inputparameter is a uniform resource identifier of a parameter resource, theprocessor retrieves a representation of a new object resource from theparameter resource that is pointed to by the uniform resource identifierof the parameter resource, and constructs the operation request thatincludes the uniform resource identifier of the object resource and therepresentation of the new object resource and that is for the objectresource in the representation of the operation resource; or when theinput parameter is a representation of a new object resource, theprocessor constructs the operation request that includes the uniformresource identifier of the object resource and the representation of thenew object resource and that is for the object resource in therepresentation of the operation resource.

In the foregoing embodiment of the present invention, the networkinterface is further configured to receive an operation resource updaterequest, where the operation resource update request includes arepresentation of a new operation resource, where the representation ofthe new operation resource includes a representation of a dependencyresource or a uniform resource identifier of a dependency resource. Theprocessor invokes the application program stored in the memory to updatethe stored representation of the operation resource to therepresentation of the new operation resource. In an embodiment, thenetwork interface is further configured to receive a dependency resourcecreate request, where the dependency resource create request includes arepresentation of a dependency resource and a uniform resourceidentifier of a dependency resource set to which the dependency resourcebelongs. The processor invokes the application program stored in thememory to save the representation of the dependency resource to thedependency resource set according to the uniform resource identifier ofthe dependency resource set to which the dependency resource belongs,and add the uniform resource identifier of the dependency resource setto the representation of the operation resource.

Further, the processor in the foregoing embodiment further retrieves,according to the representation of the operation resource, therepresentation of the dependency resource associated with the operationresource, retrieves a representation of a condition resource that ispointed to by a uniform resource identifier in the representation of thedependency resource, and determines, according to the representation ofthe condition resource, that a condition in the representation of thedependency resource is met.

Types of the dependency resource are classified into a sufficientcondition type and a necessary condition type, a dependency resourcequantity is at least one, and before constructing the operation requestfor the object resource in the representation of the operation resource,the processor further determines that a condition specified by at leastone dependency resource of the sufficient condition type is met (thatis, the processor constructs the operation request for the objectresource in the representation of the operation resource whendetermining that a condition specified by at least one dependencyresource of the sufficient condition type is met); or beforeconstructing the operation request for the object resource in therepresentation of the operation resource, the processor furtherdetermines that conditions specified by all dependency resources of thenecessary condition type are met (that is, the processor constructs theoperation request for the object resource in the representation of theoperation resource when determining that conditions specified by alldependency resources of the necessary condition type are met).

The processor retrieves, according to the representation of thedependency resource included in the representation of the operationresource, the representation of the dependency resource associated withthe operation resource. In an embodiment, the processor retrieves,according to the uniform resource identifier of the dependency resourceincluded in the representation of the operation resource, therepresentation of the dependency resource associated with the operationresource. In an embodiment, the processor retrieves, according to theuniform resource identifier, included in the representation of theoperation resource, of the dependency resource set to which thedependency resource belongs, the representation of the dependencyresource associated with the operation resource, where therepresentation of the dependency resource associated with the operationresource is a representation of a dependency resource included in thedependency resource set.

In addition, at least two operation resources are associated with thesubject resource, representations of the operation resources furtherinclude priorities, and the processor constructs an operation requestfor an object resource in the representation of each operation resourcein sequence according to the priorities in the representations of theoperation resources.

The representation of the operation resource further includes anoperation execution result, the network interface is further configuredto receive an operation response returned by the device in which theobject resource is located, and the processor saves the operationresponse into the operation execution result in the representation ofthe operation resource. In an embodiment, the representation of theoperation resource further includes an address reflecting an operationexecution result and the operation execution result, the networkinterface is further configured to receive an operation responsereturned by the device in which the object resource is located, and theprocessor retrieves, according to the address reflecting the operationexecution result, an operation result corresponding to the operationrequest, and saves the operation result corresponding to the operationrequest into the operation execution result.

Persons of ordinary skill in the art may understand that all or some ofthe steps of the method embodiments may be implemented by a programinstructing relevant hardware. The program may be stored in acomputer-readable storage medium. When the program runs, the steps ofthe method embodiments are performed. The foregoing storage mediumincludes: any medium that can store program code, such as a ROM, a RAM,a magnetic disk, or an optical disc.

Finally, it should be noted that the foregoing embodiments are merelyintended for describing the technical solutions of the presentinvention, but not for limiting the present invention. Although thepresent invention is described in detail with reference to the foregoingembodiments, persons of ordinary skill in the art should understand thatthey may still make modifications to the technical solutions describedin the foregoing embodiments or make equivalent replacements to some orall technical features thereof, without departing from the scope of thetechnical solutions of the embodiments of the present invention.

What is claimed is:
 1. A method for triggering an operation in anInternet of Things (IoT) system, wherein the IoT system comprisesmultiple IoT terminals, and the method comprising: obtaining, by aservice capability middleware, subject resource information of a subjectresource, the subject resource information comprising detected datainformation of detected data of the subject resource and operationresource information about an operation resource associated with thesubject resource, the service capability middleware being integrated ina gateway or a service platform; receiving, by the service capabilitymiddleware, the detected data of the subject resource from the multipleIoT terminals; determining, by the service capability middleware, thatthe detected data meets a condition for sending an operation request toan object resource; and sending, by service capability middleware, theoperation request to the object resource, the condition and the objectresource being determined according to the operation resourceinformation.
 2. The method according to claim 1, before the obtaining,the method further comprising: creating, by the service capabilitymiddleware, the subject resource and the operation resource; andassociating, by the service capability middleware, the operationresource with the subject resource.
 3. The method according to claim 1,further comprising: receiving, by the service capability middleware, theoperation result associated with the operation resource.
 4. The methodaccording to claim 1, wherein an object resource identifier of theobject resource comprises a uniform resource identifier, and the objectresource is saved at a device.
 5. The method according to claim 1,further comprising: receiving, by the service capability middleware, asubject resource update request comprising a uniform resource identifierof a subject resource to be updated, and operation resource informationabout an operation resource associated with the subject resource to beupdated; and updating, by the service capability middleware, storedinformation according to the subject resource update request.
 6. Themethod according to claim 1, wherein a plurality of operation resourcesare associated with the subject resource, each operation resource of theplurality of operation resources has a respective priority, and themethod comprises: detecting, by the service capability middleware, thatthe detected data meets a condition for sending a plurality of operationrequests to the object resources, wherein each operation request of theplurality of operation requests is determined based on a respectiveoperation resource; and sending, by the service capability middleware,the plurality of operation requests to the object resource according tothe respective priority of each operation resource of the plurality ofoperation resources.
 7. The method according to claim 1, furthercomprising: creating, by the service capability middleware, a dependencyresource for the operation resource, wherein the dependency resourceindicates a dependency condition for executing the operation resource.8. An apparatus for triggering an operation in an Internet of Things(IoT) system, wherein the IoT system comprises multiple IoT terminals,comprising: a network interface configured to perform communication withan external device; a memory storing instructions; a processorconfigured to execute the instructions to perform operations of:obtaining subject resource information of a subject resource, whereinthe subject resource information comprises detected data information ofdetected data of the subject resource and operation resource informationabout an operation resource associated with the subject resource, theservice capability middleware being integrated in a gateway or a serviceplatform; receiving the detected data of the subject resource from themultiple IoT terminals; determining that the detected data meets acondition for sending an operation request to an object resource; andsending the operation request to the object resource, the condition andthe object resource being determined according to the operation resourceinformation.
 9. The apparatus according to claim 8, wherein theprocessor of the client device is further configured to performoperations of: creating, by the service capability middleware, thesubject resource and the operation resource; and associating, by theservice capability middleware, the operation resource with the subjectresource.
 10. The apparatus according to claim 8, wherein the processorof the client device is further configured to perform operations of:receiving, by the service capability middleware, a subject resourceupdate request comprising a uniform resource identifier of a subjectresource to be updated, and operation resource information about anoperation resource associated with the subject resource to be updated;and updating, by the service capability middleware, stored informationaccording to the subject resource update request.
 11. The apparatusaccording to claim 8, wherein a plurality of operation resources areassociated with the subject resource, each operation resource of theplurality of operation resources has a respective priority, and theprocessor of the client device is further configured to performoperations of: detecting, by the service capability middleware, that thedetected data meets a condition for sending a plurality of operationrequests to the object resources, wherein each operation request of theplurality of operation requests is determined based on a respectiveoperation resource; and sending, by the service capability middleware,the plurality of operation requests to the object resource according tothe respective priority of each operation resource of the plurality ofoperation resources.
 12. The apparatus according to claim 8, wherein theprocessor of the client device is further configured to performoperations of: creating, by the service capability middleware, adependency resource for the operation resource, wherein the dependencyresource indicates a dependency condition for executing the operationresource.
 13. The apparatus according to claim 8, wherein an objectresource identifier of the object resource comprises a uniform resourceidentifier.
 14. A computer program stored in a non-transitory memory,wherein a processor is configured to execute the computer program to:obtain subject resource information of a subject resource, wherein thesubject resource information comprising detected data information ofdetected data of the subject resource and operation resource informationabout an operation resource associated with the subject resource, theservice capability middleware being integrated in a gateway or a serviceplatform; receive the detected data of the subject resource frommultiple IoT terminals; determine that the detected data meets acondition for sending an operation request to an object resource; andsend the operation request to the object resource, the condition and theobject resource being determined according to the operation resourceinformation.
 15. The computer program according to claim 14, wherein aprocessor is configured to further execute the computer program to:create the subject resource and the operation resource; and associatethe operation resource with the subject resource.
 16. The computerprogram according to claim 14, wherein a processor is configured tofurther execute the computer program to: receive a subject resourceupdate request comprising a uniform resource identifier of a subjectresource to be updated, and operation resource information about anoperation resource associated with the subject resource to be updated;and update stored information according to the subject resource updaterequest.
 17. The computer program according to claim 14, wherein aprocessor is configured to further execute the computer program to:detect that the detected data meets a condition for sending a pluralityof operation requests to the object resources, wherein each operationrequest of the plurality of operation requests is determined based on arespective operation resource; and send the plurality of operationrequests to the object resource according to the respective priority ofeach operation resource of the plurality of operation resources.
 18. Thecomputer program according to claim 14, wherein a processor isconfigured to further execute the computer program to: create adependency resource for the operation resource, wherein the dependencyresource indicates a dependency condition for executing the operationresource.
 19. The computer program according to claim 14, wherein anobject resource identifier of the object resource comprises a uniformresource identifier.